Closing the form with timer

Sohaila Taravati

Registered User.
Local time
Today, 15:17
Joined
Oct 24, 2001
Messages
266
I have put a timer on my switchboard with this code:
Private Sub Form_Timer()
Dim Res
Dim T As Variant
T = Format([Timer] - 1 - Time(), "Short Time")
If T >= "00:30" Then
Select Case MsgBox("Your time is up! You have left this database open for over 30 minutes. Click OK to close the databse or cancel to proceed. ", vbCritical + vbOKCancel, "Your time is up!")
Case vbOK

DoCmd.Quit
Me.Undo
Case vbCancel
Me.Undo
Exit Sub
End Select
End If
End Sub
If they click cancel it cancels and if they say ok it takes them out of the database.
What I would like to do is:
1. When the form is active the timer will not activate at all.
2. I would like to put a timer on the actual message box, incase they are not at their computer to click any of the buttons. In other words, if the message box shows up and they don't respond within 10 minutes or so, the database automatically closes.
Is this possible or not? Thank you in advance.
 
I would make the message box my own dialog from opened with the dialog window mode:

DoCmd.OpenForm "frmMsgBox", , , , , acDialog

And then I would put the quit database timer function on that form.

Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom