General discussion


Locking an Access Database

By SusanGehrig ·
I have set a database password for entry into the database but I would like the database to be manually locked or it automatically locks after a time of non-use. First, can I create a button to allow a user to manually lock the database if he/she leaves the computer? Second, can the database automatically lock if it is not in use for a certain time period and must then be unlocked with a password?

Thank you.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by Haris In reply to Locking an Access Databas ...

you can create a button and have the login form displayed so that before gaining access to the database the user has to enter the password.

you can add to the VBA code to count the inactive time on your access forms and have the login form called after certain duration of inactive time.

Collapse -

by DeskTroll In reply to Locking an Access Databas ...


This will require some coding and careful thought on your part.

The locking is simple, just open a popup modal form with a text box requiring the password to close the form.

The real question is how to measure non use of the database and open the lock form. You would require code in the ontimer event of each form or a hidden form with a single on timer event. Additionally you would probably need a global variable that is updated with each mouse click, and control entry and exit event.

Your timer would have to check this variable, record "in use" and set the variable to "Not In Use". If the variable is still not in use after x number of minutes then open the locking form.

All this processing and checking will slow down your database. You would be better off setting the password on your screensaver.

Related Discussions

Related Forums