Maximum Timer Interval?

andrewf10

Registered User.
Local time
Today, 16:04
Joined
Mar 2, 2003
Messages
114
Hi all,

Can someone please tell me what the maximum Timer Interval is on a form?

Access 2000 help is telling me 65,535 milliseconds under one help topic and thats it's "a Long Integer value between 0 and 2,147,483,647" on another.

I'm trying to close a database automatically after 12 hours (43200000 milliseconds).

Many thanks
 
Hmmmmm .......

Instead of working your timer to death and eating up valuable System Resources by triggering the code every second .....

Depending on the accuracy needed .. I would only check every minute.

I would create a "Public Variable" in a module to increment by one until it reached 720 which is the amount of minutes in 12 hours. When the variable reachs 720 ... close the app.

Here is the Public Variable for the module:

Public intAppMinutes As Integer

Now here is a sample on the code needed in the forms' On Timer event:
Code:
Private Sub Form_Timer()
Dim strMsg As String, strTitle As String
strMsg = "Application has been Open for 12 hours and will now Close."
strTitle = " Closing Application"
 
If intAppMinutes = 720 Then
  MsgBox strMsg, vbExclamation + vbOKOnly, strTitle
  DoCmd.Quit
Else
  intAppMinutes = intAppMinutes + 1
End If
Set the "Timer Interval" property of the form to 60000 so it will trigger every minute.

If you don't want the msgbox ... just remove the lines of code in the procedure above and the app will simply close with no warning.

HTH
RDH
 
Last edited:
Thanks a million Ricky, worked perfectly as ever...
 
That is "Great News" ...... :-)

You are very welcome.

RDH
 

Users who are viewing this thread

Back
Top Bottom