There is code that you can use to call a message box that will disapear after x number of seconds. I use the below code to do just that when I give the users a warning message that the application will shut down in 30 seconds. If the user clicks the OK button then the db shuts down right away, otherwise the message box will auto close in 30 seconds and then the db will shut down. It is nice to at least warn the users in the db with a message since you do not know which form they are in.
'Put this at the top of a public module [not a form module]
'Put this in your routine to force close the applicationCode:'Used with a timed message box Public Property Get oMsgBox() As Object Set oMsgBox = CreateObject("WScript.Shell") End Property
Code:[COLOR=green] 'oMsgBox.PopUp "Testing...closing in ten seconds.", [COLOR=blue]10[/COLOR], "Force Closed", vbInformation[/COLOR] oMsgBox.PopUp "Your copy of the XXXX program will be closed in thirty seconds. The data tables in the XXXX program are being updated or the XXXX program is being taken off line for maintenance. You may try to open the XXXX program again in twenty minutes." & vbCrLf & vbLf & "Please contact XXXX if you continue to have problems opening the XXXX program.", 30, "Force Closed", vbInformation DoCmd.RunCommand acCmdExit
Hi ghudson,
thank you for this code, this code working for me except the force close
'oMsgBox.PopUp "Testing...closing in ten seconds.", 10, "Force Closed", vbInformation
oMsgBox.PopUp "Your copy of the XXXX program will be closed in thirty seconds. The data tables in the XXXX program are being updated or the XXXX program is being taken off line for maintenance. You may try to open the XXXX program again in twenty minutes." & vbCrLf & vbLf & "Please contact XXXX if you continue to have problems opening the XXXX program.", 30, "Force Closed", vbInformation
DoCmd.RunCommand acCmdExit
i was not clear when you routine, where should i exactly use this