Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for Expiration Date in Access

Status
Not open for further replies.

JJO519

Technical User
Apr 21, 2007
8
US
I need help writing code for Access so a password is required after a certain number of days of use have passed. I would like my client to only have access to my database for a certain number of days.

Thank you.
 
Record the date first used. Each subsequent use, check to see if it is more than five days later.
 
MintJulep:
Thank you for your response. I don't think I understand your reply. I'm looking to implement code for such and don't know how or even if it's possible.
 

To add to mintjulep's idea,

Have a field in Access where you can store a date.
If it is empty, first time use, write today's date in it, and then every time user starts your app, check today's date against date stored in this field.

You can do the same with the registry, if you want to.

Either way, users can go to any of these places and manipulate the data 'by hand' if they know where to go and what to look for, so it is not full proof way. But it is a good start.


Have fun.

---- Andy
 
Or you could put this into the AutoExec

Code:
dim dtDate as date
dtDate = now()
if dtDate = [enter the required date] then
    docmd.quit
Else
    'Allow user into databse
End if



If you make something idiot proof - They'll Only make a better idiot!!!
 
MikeC:
I will try your suggestion, thanks a million. That's exactly what I was looking for. Hopefully I'll figure out where to put it.
Jeff
 
put it in a module and then execute the code from a macro called AutoExec this will cause it to be executed first when the database is opened.

If you make something idiot proof - They'll Only make a better idiot!!!
 
JJ,

While Mike's suggestion will undoubtedly solve your problem, it is very easy to bypass your code as it stands.

If you want to do something like this well, you will also need to compile the database to MDE format (to stop the source code being made available to your clients so they can remove the restriction or change the password) and also enable the AllowByPassKey property to stop the bypassing of autoexec and startup forms with VBA code, otherwise getting around this is easy. You will, of course, also need

You may also want to encode information about existing runs in the table so that opening it via a linked table in another Access database or as an ODBC link from another application won't let them view or modify the data easily. Ditto for any data written to the system registry.

John

 
Oops, forgot to finish that second paragraph before I hit submit. The last sentence should read "You will, of course, also need some means of getting around this for your own maintenance purposes."

John
 
Johns of course is correct. I was assuming that you had already locked your db and code up.

If you make something idiot proof - They'll Only make a better idiot!!!
 

Consider:
Code:
if dtDate [red][b]>[/b][/red]= [enter the required date] then
If not, this line will work only one day. before and after that day user will have free access.

Have fun.

---- Andy
 
Thanks everyone for your input. This is a great site with such professional and patient members. I tried the above above with an end date of tomorrow. Let's see if it blocks me out.
 
Andrzejek - Dooh, head in hands smiley lol that was written on the fly so please forgive me.


If you make something idiot proof - They'll Only make a better idiot!!!
 

I was not trying to make fun of you, or be too picky. Just trying to point 'code working for one day' ;-)


Have fun.

---- Andy
 
No worries.

If you make something idiot proof - They'll Only make a better idiot!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top