
Originally Posted by
c_smithwick
I open a hidden form in my main database (that stays open as long as the database is open) when the user first logs in, with a timer event that fires every 30 sec or so. When the event fires, a value is checked in a lookup table (Yes/No data field) that I can toggle with an update query against the table. If the value is found to be TRUE, then a warning message is displayed to the user (on a timed form which automatically closes after 30 seconds - prevents me from having to wait until the user clicks "OK" on a standard message box) and the app is then closed. If the user tries to reopen and the value is still set to true, then the user is warned and the database is immediately closed.
I use this when I need to make updates - I toggle the value, wait 30-45 sec until all users are thrown out, make my updates, and then toggle the value back, allowing users to log in once more. Works great for me, I have been using this method for two years now on a database I maintain without problems.
I actually have an "update" function that I run in a duplicate development database on my local hard drive. It pops up a form listing all the forms, modules, queries, etc and let's me select which ones I have updated, then sets the toggle value in the lookup table, waits until the ldb locking file is gone by looping a dir function on the server directory where the main database resides. When the Dir function returns a null string (indicating that all users are out), then the function copies all the changed forms, modules, etc from my development database to the main database and resets the toggle value allowing users to log back in. All I have to do is run the update macro which opens a form, click the stuff I need to update, click "GO" and sit back and wait until updates are made. Once I got it written it sure saved me a lot of time when making updates. I have attached a sample you can cannibalize if you want . Once you run the macro it loads the form listing all of your components. Check to ones you want to update and click GO. I think all the code is pretty simple to follow.