Timer event

KenHigg

Registered User
Local time
Today, 03:15
Joined
Jun 9, 2004
Messages
13,310
I have the timer stuff on a hidden form set up to close a db if a var is set. I know that if there is a msgbox open the timer code will not run, probably because it's modal (?). What other things will zonk my on timer code and are there any other suggestions as to how to go about forcing users out of a db?
 
What triggers the variable to be set? Why not just close the database at that time?
 
This is a typical way to close or force users out of a database when you need to open it exclusively to make changes or compact it. When your database opens you have a hidden form that opens and stays open that has the timer event set to check the status of a variable say every few minutes. Normally the status would be something like 'true' and in that case nothing happens. But if you set the value to 'false' the code in the timer would close the database. So as admin, if you wanted everyone out of the database you simply set the value to 'false' and wait for the timer event to run the code. I typically set it to run every 5 minutes. The first time it runs I simply advise the user that the db will close for maint. in five minutes. The second time through the code will actually close the database.

The problem with this is that there are times when the code will not run, one is if there is a msgbox open. I was wondering if anyone else knew of any other things that would prevent the code from running and find out if there is any other, maybe bullet proof ways to force users out of a database...
 
You could run the timer and close the database from an external script. A .vbs file should work fine.
 
a. The script would have to be on the local workstation, right?
b. How would an admin signal to the script to run and close the db?
 
The script can be stored in on a server, but it will run on whatever workstation runs it.

It would run when the hidden form opens. If it reads that the variable is false, the timer loop would exit and finish running the script, closing the database. When the hidden form is closed, you can end the script process in case the variable is still true.
 

Users who are viewing this thread

Back
Top Bottom