How to force users out of an Access application after a certain period of inactivity

mlcktmguy
mlcktmguy used Ask the Experts™
on
I need to do some work on a client's DB.  Despite the clients best efforts and repeated emails some user don't close the Access 2013 application when leaving for the day.  I did some research on forcing user out of the DB after some period of inactivity and came up with this solution on the Microsoft website.

Microsoft Suggestion For Forcing User Out of an Application

I am hesitant to use this one due to its use of 'TimerInterval'.  Somewhere along the line in my many years of Access development I remember being warned against using the 'TImerInterval' because in some way it could become problematic.  

Do any of you have experience with the having to remotely shutdown users due to inactivity?  DId you use the 'TImerInterval' function or are there better methods?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fabrice LambertConsulting
Distinguished Expert 2017

Commented:
Well, MS Access wasn't build with real time in mind, but it work (more or less).

Be warned that sometimes, user shut down the application, but for whatever reasons, a connection remain open, so it isn't an absolute solution.
Database Architect / Application Developer
Top Expert 2007
Commented:
This is free and will work for you. I built an entire Forced Shutdown module to shutdown multiple dbs based on Peter's app.

http://www.peterssoftware.com/isd.htm

Check it out.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
One important thing here is that you not force the user out outside of the application.   That can corrupt the DB.

 There is a passive shutdown feature built into Access, but that relies on the user to exit (it just prevents new users from connecting to the DB).

 So whatever you do, it needs to be built into the app.   Usually that involves setting some type of flag, then within the app, checking for that flag and doing the exit from the app.

Jim.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

John TsioumprisSoftware & Systems Engineer

Commented:
Well there is another way...(too bad i don't have the time to polish it and release it) ...you just could locate the database on the BE and close them...like connecting to the machine that "holds" the back end
The Manual way --> Shared Folders --> Open Files --> Close Them
The Automatic way  --> it can be done via VBA.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
@John,

 <<The Manual way --> Shared Folders --> Open Files --> Close Them>>

  You absolutely do not want to do this on a JET/ACE database.   You never want to force close a connection.

  If you do it this way, you have to be absolutely sure the user is idle.  If they are working with the DB, you can corrupt the DB.

Jim.
Daniel PineaultPresident / Owner CARDA Consultants Inc.
Distinguished Expert 2018

Commented:
There is nothing wrong with using a Timer.  Obviously, you don't want to run a timer on every form ..., but in the context that you are talking about it is absolutely fine.

As for what can be done, I urge you to look over the following 2 solution (similar, but for different applications).


I've been using them in pretty much all my databases for 10+ years and never had any issues whatsoever.
Distinguished Expert 2017

Commented:
The timer is more of a danger to you during development.  That is what you need to watch out for.  In the rare instances where I use a timer for anything, I add code to the open event of the opening form to check to see if it is me opening the database.  If it is me, I pop up a question asking if I want to run the timer events.  I say yes if the timer event code is what I am testing.  I say no in all other cases and the code sets the timers all off.  What you are trying to avoid is opening an object and making design changes when there is an open form with a timer event running.  You can loose your changes and it can corrupt the database.
John TsioumprisSoftware & Systems Engineer

Commented:
@Jim in the 10+ years i have used in a heavy environment of 100+ users i can't remember if i had a case of corruption.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012

Commented:
Depends on when your trying it.  Again, if there is not activity, you can get away with it.

 But this is no different than doing a CTRL/Alt/Del, Rebooting the server, etc.   None of which you want to do with a JET/ACE DB.

 Your terminating the connection without closing the DB through Access.

Jim.
Mark EdwardsChief Technology Officer

Commented:
I've used the timer in my app shell that I use to build new apps with.  Just watch the demo to see how it works:
https://www.youtube.com/watch?v=-A8fu--aa6k

It depends on how you close out.  There is a difference between "close" and "quit".  If you try to close gracefully and a popup (to save or do whatever) opens, then it can halt your closing code.  You'll want to avoid this by just "Quit", but even then, no guarantees that everything will work right.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial