I built it in VBA.
I have a form that loads hidden as one of the first things the app does.
It has some code
Here's the declarations.
I want things to close at 9 PM
Option Compare DatabaseOption ExplicitConst timeToRun As Date = #9:00:00 PM#Const DelayFromLastActivity As Long = 5'minutes of delay
Some code to quit the application if the timer goes off
I have a message to users when they try to quit allowing a cancel.
They always click the wrong X
Private Sub Form_Unload(Cancel As Integer)Dim response As IntegerIf DontSkipMessage = True Then response = MsgBox("Did you really intend to quit The Program? Yes to Quit, no to remain in The Program", vbYesNo + vbCritical, "Quit?") If response = vbNo Then Cancel = True If Application.CurrentProject.AllForms("frmStartupScreen").IsLoaded = False Then DoCmd.OpenForm "frmStartupScreen" End If End IfEnd IfEnd Sub
Then in any of the forms likely to be active, I have code to bump theInterval back past 9:05 PM if they are working on the form.
The locations of that code vary because of the nature of the forms I monitor, but it is basically like the OnLoad code.
If this timer event goes off, the app quits.
And the timer event only happens once!
No Timer heartbeat grief.
I have a form that loads hidden as one of the first things the app does.
It has some code
Here's the declarations.
I want things to close at 9 PM
Open in new window
some OnLoad code, to set a timer interval
Open in new window
Some code to quit the application if the timer goes off
I have a message to users when they try to quit allowing a cancel.
They always click the wrong X
Open in new window
In a code module, I have
Open in new window
Then in any of the forms likely to be active, I have code to bump theInterval back past 9:05 PM if they are working on the form.
The locations of that code vary because of the nature of the forms I monitor, but it is basically like the OnLoad code.
If this timer event goes off, the app quits.
And the timer event only happens once!
No Timer heartbeat grief.