Yolly,
When the Access database is opened, automatically open a form to be the timer form. You might want to make it invisible, or make it very small and place it in a corner of the screen where the user can see it and be reminded that the thing will shut down at 5:00.
There are two Event properties you will set. In Timer Interval, put a number (N * 60000), where N is the frequency in minutes you want to check to see if it is 5:00 or later. If you want to check every 30 minutes, you will put a value of 1,800,000.
In the OnTimer event of the Form, place the following code:
- if hour(now()) = 17 then
-
DoCmd.Quit
-
endif
-
You might want to issue a warning message in case somebody is working in the program. If you want to quit exactly at 5:00, then you could subtract the time between 5:00 and the current time, and use vba code to change the timer interval to the number of milliseconds until 5:00. The next time the timer fires, it will be 5:00.
Jim