Hello Code Hungry Vultures!
This is a database demo complete with source. It illustrates how to force a shutdown or automatically shutdown from inactivity for a specified number of minutes.
This allows forcing users out for emergency maintenance such as compacting & repairing because of partial corruption or whatever, and inactivity shutdown for those who loiter in the database when off hours scheduled maintenance is needed such as compacting & repairing, or updates to tables, etc.
It is a front end database with a linked back end database.
On first opening Shutdown.mdb use the shift key to prevent the Autoexec macro from executing.
Then refresh the link for table MsgCenter in BACK_END.mdb.
The fields in the MsgCenter table:
ShowMsg----------Yes/No---Set this to True/Yes to force shutdown
MSG--------------Text-----Message to display in ShutdownMsg form
MsgBxTitlBar-----Text-----Titlebar caption to display in ShutdownMsg form
MaxInactiveTime--Integer--Max Inactivity Minutes
StartMonitor-----Integer--Time of day to start monitoring inactivity - 0 (12AM) to 24 (12PM)
EndMonitor-------Integer--Time of day to end monitoring inactivity - 0 (12AM) to 24 (12PM)
After link is refreshed either exit Shutdown.mdb and open again to run the autoexec macro or just run the autoexec macro without exiting.
Then open the MsgCenter table & click ShowMsg & close the table.
Forced shutdown will occur immediately.
For inactivity shutdown:
Open the MsgCenter table.
Change StartMonitor to an hour earlier than the current time.
Change EndMonitor to an hour later than the current time.
Set MaxInactiveTime to 1 (1 minute) and close the table.
Inactivity shutdown will occur in 1 minute.