Secure Access Backend

Triple used Ask the Experts™
I want to secure the backend of my Access 97 database through VBA code. I've seen this once, so it is possible. A screen popped up when i tried to open backend.mde that told me i'm a naughty boy :) and the file didn't open Well, the screen is right, and i want to build one to!
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

The simplest way to do it is by creating a password on the back end, this will lock it out.  Now remember, this is not a fail save method, there is a password hacker for Access available.  

go into tools-security-database password.

simplest way is to make an autoexec macro which pops up a form and then closes the database if it is closed or loses focus.
Of course you have to get around the "Shift" bypass key problem.

Alternatively have some code to extract the current logged on user and close if it isn't a system admin.

Just some ideas

good luck



Those are some options that crossed my mind, but i'm really looking for the VBA code sollution.
First disable the Shift-key bypass. There are several PAQs out there decribing this process.
Second, password protect the backend database. If you don't set a database password, users can stil get to your tables by linking or importing from another database.
Third, add a startup form to your database. In the Onload event of the form add some code like this:

Dim strPath as String
strPath = CurrentDB.Name
If Right(strPath, 3) = "mde" Then
    MsgBox "You Naughty boy"
    ' let the form open if it's an mdb file
End if

Note that you will still have access to your table for administration, you just have to supply the password.
An alternative is to also see who is logged into the computer and allow certain login names to be able to open the mde.
Jim Dettman (EE MVE)President / Owner
Most Valuable Expert 2017
Most Valuable Expert 2012


 Depends on what you mean by "secure".  There are two levels of Access security: file level (database password) and User Level (JET security).

 From your initial comments it sounds like you bumped into a database with the latter, but it's hard to say without the exact wording of the dialog.

 First question is, why do you want to secure it?  Either form of Access security is easily breakable.  Is this just to stop the casual user or what?


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