troubleshooting Question

Shut down db at specific time

Avatar of Dale Logan
Dale LoganFlag for United States of America asked on
Microsoft Access
28 Comments2 Solutions591 ViewsLast Modified:
I am trying to implement the solution given for this question:

However, nothing happens except the message box. One piece I was not sure about is where the expert says to "create a Class Module variable at the Form level". I've never created a class module and don't know how to do it at the form level. All I did was simply created a Class Module and added the line he recommended.

Option Compare Database
Dim vMsgSent As Variant

Here's my code in the OnTimer event for the open form:

Dim MyDB As Database
Dim MyRS As Recordset
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("tblDBParameters", dbOpenDynaset)
If MyRS("ShutDown") Then
   If Not (vMsgSent) Then
      vMsgSent = True
 MsgBox "This application will automatically shutdown at " & Format(MyRS("ShutDownTime"), "General Date") & ". Please exit NOW!!"
   End If
   If Time() >= MyRS("ShutDownTime") Then
   End If
End If
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 28 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 28 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros