RE: I didn't think of this
- From: PaleRider <PaleRider@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 Jul 2009 16:37:01 -0700
Klatuu,
I found the code I need looking at other posts in this forum. Apart from a
few changes, I believe this code was written by you for someone else :-)
Thanks a million Klatuu for your response and willingness to help. We really
do need you here!!
' Here's what I put in the OnOpen section:
Private Sub Form_Open(Cancel As Integer)
Dim mySQL As String
Dim myDB As DAO.Database
Dim mySet As DAO.Recordset
Dim numRecords As Integer
varSQL = "Select * from Main"
Set myDB = CurrentDb
Set mySet = myDB.OpenRecordset(varSQL)
If mySet.BOF = True Then
'there are no records in Main - so return 0
numRecords = 0
Else
mySet.MoveLast
numRecords = mySet.RecordCount
End If
End Sub
-PR
"Klatuu" wrote:
There is a fairly simple solution for your problem. You could use two user.
defined database properties to control it. One property would be the
installed date. When the user first opens the database, check for the
existance of the property. If it is not found, then set it to the current
date, otherwise, compare the current date to installed date.
That does not handle someone resetting the system clock, but there is a
sneaky way to deal with that as well. Use another database property that
will be Last Opened Date. After a user opens the database and you complete
the comparisons above, check to see if the system date is prior to the Last
Opened Date. That will tell you if the user has set the clock back. Then in
the UnLoad event of the form, update the Last Opend date to the current date.
--
Dave Hargis, Microsoft Access MVP
"PaleRider" wrote:
I think I have a different solution. I'll post back with results.
-PR
"PaleRider" wrote:
Hi again,
I have code that prevents the use of a form after a certain amount of days.
What I didn't consider is someone just changing the date on the computer.
Now, I have to figure out how to handle that otherwise it's a mute point.
The code I have in place so far has flaws that can be exploited. Is there a
way to allow someone limited use of database for a certain time frame, then
disable it after that?
Here's the code I have so far which allows use for 14 days, but as mentioned
before it can be exploited by just changing the system date:
Private Sub Form_Open(Cancel As Integer)
Dim myDate As Date
myDate = #6/2/2009#
If DateDiff("d", myDate, Date) >= 14 Then
MsgBox "Your 7 day evaluation for this database has expired."
Cancel = True
End If
End Sub
-PR
- References:
- I didn't think of this
- From: PaleRider
- RE: I didn't think of this
- From: PaleRider
- RE: I didn't think of this
- From: Klatuu
- I didn't think of this
- Prev by Date: Re: Syntax for saving an exported Excel file as csv
- Next by Date: Re: Drop Down / Combo Box
- Previous by thread: RE: I didn't think of this
- Next by thread: SP2 VBA Find Command
- Index(es):
Relevant Pages
|