Code need for automatic shut down of database.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all:
I looking for some code that would automatically shut down a database
(Access 2000) at a given time, say 10:00 p.m. The reason for this code is
becuase some users of the database forget to shut it down before leaving the
office and I would like to shut it down before our back up routine runs at
night.

Any help would be greatly appreciated?


Thanks,
FatMan
 
Make sure you have a form that's always open (even if it isn't visible).

Use that form's Timer event (in conjunction with the TimerInterval property)
to check regularly for what time it is. If it's after 22:00, shut down
Access. If it's possible there might be some users still using the
application at that time, you might want to give them a 2 minute warning, so
that they can complete what they're actually doing.
 
FatMan said:
I looking for some code that would automatically shut down a database
(Access 2000) at a given time, say 10:00 p.m. The reason for this code is
becuase some users of the database forget to shut it down before leaving the
office and I would like to shut it down before our back up routine runs at
night.

Assuming you have a main form which is always open you can use the
form's Timer event ("On Timer"). Something like:

Private Sub Form_Timer()
If Now() > TimeValue("22:00") Then
Application.Quit;
End If
End Sub

Or, you could use a tool like Macro Scheduler:
http://www.mjtnet.com/macro_scheduler.htm

Marcus
http://www.mjtnet.com/
Macro Scheduler - Software Process Automation
 
Back
Top