How can I kick someone out of a shared database?

Wag2016

Registered User.
Local time
Today, 08:00
Joined
Mar 5, 2016
Messages
24
I have a split database with each user having their own frontend copy. Sometimes people leave their database open for extended periods of time. This affects my ability to make any table changes.

Is there a way to kick a user out?

Thank you!
 
How often do you make table changes? This should be an extremely rare event, and not part of your regular workflow.
 
I made a table called tblMaintenance with one field (yes/no) and put a timer event on the main form to check tblMaintenenace for a yes checked every 2 minutes. If yes is checked, another form pops up that has a timer event (and gives a 2 minute warning) that closes the application after 2 minutes.
When I am done, I simply uncheck the yes/no checkbox in tblMaintenance.

Also, make an event (under Form_activate) on your main form to check tblMaintenance. Display a message saying closed for maintenance (if tblMaintenance field= yes), close the application after message box ok.
 
There is no way for you to externally kill a session without one of those desktop-sharing programs. But there IS a way for you to program the application to kill itself.

The only way I know to make this work is to assure that your users do not see the navigation pane. You need a switchboard or dispatcher form that never closes and that stays maximized. When you open a new form from the dispatcher, be sure to use DoCmd.BringToFront (or you can look up the Win32 API call that does this). The point is that your working forms hide everything else, too. You will also need to assure that nobody sees the ribbon or menu bar (depending on your version of Access).

Then, as midmented suggests, have a Timer event in a form. I always have it in the main switchboard form. Make it capable of kicking folks out via Application.Quit, and be sure that if you are going to kick folks out, you have a Form_Close event on every form that can track the state of the form to know if it is dirty or not. If it is, you can also force an Undo before closing individual forms.

It isn't easy but it is doable.
 
Hi, I suggest that never rely on flags. Your application may fail in case of a software, hardware or power failure. State of flags will be out of control then. Best way is to, at back-end PC, open a form with trivial table that is nowhere used in your application. Set record locks to all records. Now at front end application periodically add and delete some random data to this table. When form is opened at backend, you will get error 3262. Capture this error to close your application. This is failure proof.
 
How does that kick people off the DB?

Hi, I suggest that never rely on flags. Your application may fail in case of a software, hardware or power failure. State of flags will be out of control then. Best way is to, at back-end PC, open a form with trivial table that is nowhere used in your application. Set record locks to all records. Now at front end application periodically add and delete some random data to this table. When form is opened at backend, you will get error 3262. Capture this error to close your application. This is failure proof.
 
ravi, if you lose power, you have for all practical purposes lost the connection and the session - and probably corrupted the database in the case of an Access shared back-end.
 

Users who are viewing this thread

Back
Top Bottom