melanie_s_m
New member
- Local time
- Today, 15:36
- Joined
- Jul 28, 2006
- Messages
- 3
Firstly, many thanks to all the unsung heros of this site who offer their time & expertise to the VB challenged.
However, after months of using this site - I finally need to post.
I have an mde database that our staff access to look up clients & run reports (it's a split front/back end).
Long story - but need to close this database at 12.45pm everyday to update some back end tables (due to odd network, there's no way around this).
The person who runs this update has been having problems of people remaining in the database & so can't update it.
I fixed this by using the OnTimer event which fires from 12.45pm to 1.00pm asking people to exit out of the database.
Ok, I thought I'd fixed it. We now have people leaving the database open & going out to lunch ....
I would like it to now display a message saying that it's going to close the database & give a delay of a few seconds & then close it. Therein lies my problem.
I've searched the forum & cobbled together some code that I almost understand & almost works.
It happily brings up the message box at the correct time, but the delay & the closing of the database happens ONLY if the user presses OK.
I know that my problem is that the message box is waiting for a response before it proceeds, but I don't know how to get around this.
I have tried a couple of things, including trying to force the response, but no joy.
Help.
However, after months of using this site - I finally need to post.
I have an mde database that our staff access to look up clients & run reports (it's a split front/back end).
Long story - but need to close this database at 12.45pm everyday to update some back end tables (due to odd network, there's no way around this).
The person who runs this update has been having problems of people remaining in the database & so can't update it.
I fixed this by using the OnTimer event which fires from 12.45pm to 1.00pm asking people to exit out of the database.
Ok, I thought I'd fixed it. We now have people leaving the database open & going out to lunch ....
I would like it to now display a message saying that it's going to close the database & give a delay of a few seconds & then close it. Therein lies my problem.
I've searched the forum & cobbled together some code that I almost understand & almost works.
It happily brings up the message box at the correct time, but the delay & the closing of the database happens ONLY if the user presses OK.
I need to close it if the user has pressed OK
AND
I need to close if if the user is not there to press OK.
AND
I need to close if if the user is not there to press OK.
I know that my problem is that the message box is waiting for a response before it proceeds, but I don't know how to get around this.
I have tried a couple of things, including trying to force the response, but no joy.
Help.
Code:
Private Declare Function timeGetTime Lib "Winmm.dll" () As Long
Private Sub Form_Timer()
Static blnInitialized As Boolean
[INDENT]' Defaults to 0 (Zero, False) on Form Open.[/INDENT]
Static lngFormOpenTime As Long
[INDENT]' Will hold the Form Open Time.[/INDENT]
Dim MyTime
MyTime = Time
[INDENT]' Will hold the Form Open Time.[/INDENT]
If MyTime > TimeSerial(12, 45, 0) And MyTime < TimeSerial(13, 0, 0) Then
MsgBox "Closing for update. Please try again in 15 minutes", vbMsgBoxSetForeground
If Not blnInitialized Then
blnInitialized = True
Me.TimerInterval = 1000
lngFormOpenTime = timeGetTime()
End If
Application.Quit
End If
End Sub