I was wondering if anyone knows how to program an Access 97 application to close itself if a user is inactive for a certain length of time.
I have an Access front-end database with approx. 30 users (each with their own mdb file) that links to a single back-end mdb file. There is a main menu form that all users keep open at all times. Can anyone help? Thanks in advance for any help you can offer.
City of Olympia, WA
P.S. As a side, I am working to move this back-end to SQL Server because of problems we are having. More on that another time.
This can sometimes become problematic. But, with a main form which is always open, things get a LITTLE bit easier.
This solution involves the use of the TimerInterval property of a form--which is not one of Access' best features ('cause if sucks the horsepower from a client machine).
Basically, you need to set the TimerInterval property of the main form to 1,000 times the inactive interval, as expressed in seconds. So, for a 30-second interval, you would set this property to 30000.
Then you need to add event code to the OnTimer event. The first thing you need to add is: me.TimerInterval=0. In other words, you need to shut off the 30-second timer once it has been triggered. You'll need to follow this up with whatever clean-up code you require, terminating with a DoCmd.Quit.
The real work comes in adding calls to reset that TimerInterval property whenever the user takes an action. So, on every form, you will need to set the KeyPreview property of the form to Yes and you will need to add event code to the OnKeyPress event which reset the TimerInterval on that main form to 30000. And, you will need to reset that TimerInterval property on the MouseDown event of every section and every control on every form.
Peter, Thank you so much for the solution. I really think this will help minimize the problems we've been having with our application due to people keeping their front-end open when they're not using it.