I've written code to do this, but I don't have it to hand. There should be something in the help file - basically cobbled my code from theirs.
You will have to have your database secured and enter a user name. The allowbypasskey should be called form code, this code should be called form the Autoexec macro.
The first piece of code should check the currentUser, e.g.
If CurrentUser ="George" then
exit sub 'Or omething to get you out of here
AllowbypassKey=false 'or call another sub to set this
Be aware though that when this has been run once the next time any user uses the database they will be able to use the Allowbypass key. If you open the database this way run it once more without using the bypass key.
Also this code won't work the first time you run it, but it should the second time.
And whatever else you do make a copy of your database before you start putting this code in!!
Personally I've got tot he stage where I lock the database down so that no-one can bypass the opening macro, form etc, then leave a way in one one of the forms.
By clicking on a button a dialogue form is opened, ths asks for a password, if the wrong password is entered the form closes, but when the orrect password is opened the database is exposed for a developer to make changes etc. This way you don't need to re-open the database or worry about security files etc, but it does have its weaknesses.
OK, I have created a small database that Shift key locks/unlocks the main db . This small db will be kept in a secured directory on the server along with the .mdw file.
The next step is to prevent the main db from being copied/imported into a new/empty one. The best way everybody says is to protect the main db with a password but in the current set up users are asked for the main db password after logging on with their own IDs which sorta defeats the purpose.
Question: Is there a way to submit main db password in the start up form code? This way, when the main db is Shift key locked wicked users won't be able to copy/import it into a new/empty one.
P.S. the main db has a lot of very sensitive proprietary info ($$$ if sold).
I've used this way
Data and Application are spilt as different MDB files .
Application uses links to the Data MDB, Data MDB is password protected, and Application is code protected (you can even use your own security sisted with user names and passwords, via forms and codes)