Automatic Crash Code

goatroapr

New member
Local time
Yesterday, 18:36
Joined
Jul 6, 2011
Messages
7
Hello. I want to set a code to have Access automatically crash after like 3 months of use. My reasoning is that even if prior to a final completion of my database, it was taken and used by another then unless the code is removed prior to distribution, it would crash after a certain time period. I know I can set a password but those can be easily cracked but the code would be harder to locate. Any thoughts if this is a good idea or not? Thanks
 
I would say its possible but you would need a set a code that would typically look like it was doing something for the system but not be apparent to someone else. If you already have a lengthy startup routine then that might just be a perfect spot to hide it.
 
I do have a form that loads. It is on a timer event that disappears after said time and then loads main form. I found another posting but cannot link to it. I will give it a try and report back.

*UPDATE*
Ok, that wasn't what I was looking for. If I were to set perhaps an EXIT code after my form loads like: If [DATE]+60 Then appAccess.quit
would that work?
 
Last edited:
whatever you decide on, put it in an mde/accde - then users cannot see your code.

OK - protection schemes can be as complex as you like, but ultimately come down to you using some code to test some value - and let the database run/not run depending on the value.

So testing the date is Ok, but if the user just changes the date on the PC , will the database still run?

The other thing is that just testing a date may not prevent users passing your database to other people - so what is also often important is a "licensing" method for each PC.
 
This may be a reach but you could get the time from the internet using a programmatically setup web browser and retrive the value from the website.

I just went out and looked the source for this web site:

http://www.time.gov/timezone.cgi?Eastern/d/-5

If you look in the source for this you will find before the time value is this string:

<td align="center"><font size="7" color="white"><b>

Which is the first entry like that string. Then all you need to do is retrieve the source programmatically from the web site like this:

Code:
Const OLECMDID_PRINT = 6
Const OLECMDEXECOPT_PROMPTUSER = 1
Const OLECMDEXECOPT_DONTPROMPTUSER = 2
Dim ie As Object
Dim strWebPage As String
Set ie = CreateObject("internetexplorer.application")
strWebPage = 
[URL="http://www.time.gov/timezone.cgi?Eastern/d/-5"][COLOR=#810081]http://www.time.gov/timezone.cgi?Eastern/d/-5[/COLOR][/URL]
ie.Navigate strWebPage
Do While ie.ReadyState < READYSTATE_COMPLETE
        DoEvents
100        lngCounterWeb = lngCounterWeb + 1
101        If lngCounterWeb = 3000 Then
            DoEvents: DoEvents: DoEvents
            DoEvents: DoEvents: DoEvents
            DoEvents: DoEvents: DoEvents
            DoEvents: DoEvents: DoEvents
            DoEvents: DoEvents: DoEvents
102            GoTo TryAgain
103        End If
104    Loop
CheckPage = WebBrowser1.Document.DocumentElement.innerhtml

That code should get the info from the website into CheckPage. Now just use CheckPage and do a instr command and maybe a mid command to retrieve the value then calculate if the program is still valid or not.

The code I posted is not 100% as I am in a huge hurry with my own developments but I hope it gets you somewhere.
 
Unfortunately, the program is being built on a closed system with no internet access so I cannot use that to go out and find the internet time. I have tried several combinations of the following code but when it should stay open (if I changed the date to a forward date) it closes when it should stay open and if I change the date to an earlier date it closes as well. Am I missing something? I have tried several possibilities (>; <; <=; >=) with either all combinations leaving it open or all of them closing it.

Private Sub Form_Timer()
Dim MyDate As String
MyDate = "July 1, 2011"

'On the forms timer event close the start-up form
DoCmd.Close acForm, "frmLegal"
If MyDate < Date Then
DoCmd.Quit
Else
'Open up the main switchboard form when the start-up form closes
DoCmd.OpenForm "Switchboard"
End If
End Sub
 
you need it like this - you may need to format the date slightly differently.

Dim MyDate As date
MyDate = #July 1, 2011#
 
Ah man, now I remember reading that before in my book. That worked like a charm gemma-the-husky.

My first database with VBA. I love this kind of stuff!!
Thank you for your assistance.
 

Users who are viewing this thread

Back
Top Bottom