We help IT Professionals succeed at work.

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

mlcktmguy
mlcktmguy asked
on
109 Views
Last Modified: 2019-03-21
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

Fabrice LambertConsulting
CERTIFIED EXPERT
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
CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Jim Dettman (EE MVE)President / Owner
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017

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.
John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

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
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017

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.
CERTIFIED EXPERT
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.
CERTIFIED EXPERT
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
CERTIFIED EXPERT
Distinguished Expert 2019

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
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017

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
CERTIFIED EXPERT

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.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.