Demo Database expiry date

G

Guest

I have written code for expiry date for a demo data base as follows: The
error occurs as a compile error in this line and I am not sure what is wrong.
Thanks for any help

Dim db as DataBase

Option Compare Database
Dim db As database
Dim rs As DAO.Recordset
Dim x As Integer
Dim y As Integer

Function StartUp()
On Error GoTo Err_ProcedureName

Set db = CurrentDb
Set rs = db.OpenRecordset("tblDateFlagged", dbOpenDynaset)

If rs.EOF = False Then
rs.MoveLast
If rs.Fields("FlagDate") = True Then
MsgBox "This Database has expired. Please contact vendor to
purchase.", vbOKOnly, "Serious Warning"
DoCmd.Quit
End If

If Date > rs.Fields("MeDate") Then
MsgBox "You have set your date forward and the database will be
closed to continue to use the rest of your 30 days reset your date to the
current date and reopen the database", vbOKOnly, "Serious Warning"
DoCmd.Quit
End If

rs.MoveFirst
If Date < rs.Fields("MeDate") Then
MsgBox "You have set your date back and the database will be closed
to continue to use the rest of your 30 days reset your date to the current
date and reopen the database", vbOKOnly, "Serious Warning"
DoCmd.Quit
End If

Else

If rs.BOF = True Then
y = 0

Do Until x = 30
x = rs.RecordCount

rs.AddNew
rs.Fields("MeDate") = Date + y
rs.Update
y = y + 1
Loop
End If
End If
UpdateTable

Exit_ProcedureName:
Exit Function

Err_ProcedureName:
MsgBox Err.Description, vbOKOnly + vbCritical, "Function Start Up"
Resume Exit_ProcedureName

End Function
Function UpdateTable()
On Error GoTo Err_ProcedureName

Set db = CurrentDb
Set rs = db.OpenRecordset("tblDateFlagged", dbOpenDynaset)

If rs.BOF = False Then
rs.MoveFirst

Do While rs.Fields("MeDate") <= Date
rs.Edit
rs.Fields("FlagDate") = True
rs.Update
rs.MoveNext
Loop

End If

Exit_ProcedureName:
Exit Function

Err_ProcedureName:
MsgBox Err.Description, vbOKOnly + vbCritical, "Function Update Table"
Resume Exit_ProcedureName
End Function
 
J

Jeff Conrad

If I may quote Doug Steele on a past post:Database is a DAO object. By default, both Access 2000 and 2002 use ADO.

With any code module open, select Tools | References from the menu bar,
scroll through the list of available references until you find the one for
Microsoft DAO 3.6 Object Library, and select it. If you're not going to be
using ADO, uncheck the reference to Microsoft ActiveX Data Objects 2.x
Library

If you have both references, you'll find that you'll need to "disambiguate"
certain declarations, because objects with the same names exist in the 2
models. For example, to ensure that you get a DAO recordset, you'll need to
use Dim rsCurr as DAO.Recordset (to guarantee an ADO recordset, you'd use
Dim rsCurr As ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html


in message:
I have written code for expiry date for a demo data base as follows: The
error occurs as a compile error in this line and I am not sure what is wrong.
Thanks for any help

Dim db as DataBase

<<code snipped>>
 
T

Tony Toews

Roger Bell said:
I have written code for expiry date for a demo data base as follows:

Tools available from sites such as sysinternals.com can crack any
method you use to store a future date anywhere on a system such as in
the registry or a file. Unless it's encrypted. But even then if you
delete the date from wherever it's stored your app may think it's just
installed.

Thus I prefer to limit the number of records in one key table such as
5 units or 50 volunteers but allow unlimited access for everything
else. Once I get paid then I email them an encrypted file containing
the number of records they are licensed for as well as their company
name which goes on the bottom of every page of every report.

For more of my thoughts on this topic see the "Copy protection or how
to safely distribute a demo Microsoft Access Application" page at
http://www.granite.ab.ca/access/demo.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top