Well, I use somthing to close a DB down when the time = twelve midnight...
1) Create a form with a timer that is set to one second.
2) when this timer is reached, check if the time is between 12am and 1am...
3) Application.quit
I suppose you would need to do somthing along these lines, however reset the timer everytime any bit of your code was accessed...!
The other method that could possibly be used, is to access to windows API, check for inavctivity (like a screensaver would) and close from there.. however, I've not attempted to do this before.. got a funny feeling I will be very shortly ;D
Hmmm...well, the inactivity would only apply to Access. They may be fondling other applications and such, so your first suggestion appeals to me a bit more. I would appreciate any insight into the matter...
each time your user adds a record, or opens a form, an event is triggered yeah?
So.. for each one of these events that contains code call a seperate function. This function should capture who the user is, and what time the event was fired and stick that info into a table.
Then, you have a seperate form, opened on startup and not closable by the user, that has a timer on the form set to one second.. every time that timer is hit run some code to check the Dmax() (latest) time entry for that user in the above table.. If that time is greater than 5 miniutes.. run the APplication.Quit bit and voila.
COuple of points to the negative.
1) Doing this on every single event posible will be unrealistic.
2) Doing it on all your current events that contain code will still be labour intensive
3) You cannot capture events such as openeing tables or queries, when done so directly from the Database Window, nor events such as changing data in a table, unless its done through code.
The other said solution could possibly use the windows API.. but this would mean that a user could have been working for hours on end in something like outlook (and not touch the access db)..
I'm not sure how else this could be done directly on an MDB.
Thanks for your input. How can such a simple idea be so compicated to bring to fruition? I simply cannot get some of my users to exit a database after they finish using it - and the computer it is used on is shared by several of our production employees. So if someone leaves the database open, the next guy that logs something in it has the guy who opened it's name associated with the record he made or modified. Maybe Microsoft will make a wizard for this function some day.
Did you ever find a neat solution to this problem?
I have had exactly the same issue in the past, and my solution (actually, more of a "work-around" than a solution) is a little clumsy but does the job:
Create a hidden form that opens on start-up with a timer interval set to 5 mins (or whatever). On the OnTimer event, a message box pops up asking the user if they are still using the application. If the "yes" button is clicked then nothing happens - the user continues. If either the no button is clicked, or if nothing happens after another timer interval, then the application closes.
As I said, its clumsy, but it seems to achieve what you're after - ie application not being left open indefinately. If you want I can fish out the code I used and post it, if you're interested.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.