Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exclusive Access

Status
Not open for further replies.

lifter10

MIS
Dec 3, 2003
45
US
I have a database that multiple users will use, but I want them not to be able to open (even shared access) that database when someone else is in it. They should only be able to open it when no one is in it. I have checked the exclusive box in the Options menu and that doesn't seem to do the trick fully. I'm using Access 97. Thanks.
 
I don't believe there is a "single-user" mode that can be set in the database. The exclusive open option is a default for each user, not each database. You can add a parameter to a shortcut to the database that makes it open the database exclusively but users could still open the db directly.

Another option using VBA is to have the database check for the existence of the "ldb" file when the database is first opened (using the AutoExec macro or the OnOpen event of the form that is set to open automatically). If it exists, then exit the application because the database has been opened already in shared mode. If the ldb doesn't exist and someone has the database opened exclusively, they'll get the Access error to begin with. If they know about the special bypass key, however, this can also be circumvented.
 
Here is a method that may work for you. Change the security of the folder that the database resides in. Do not give users the ability to create files/write files.

This action will not allow the user to "write" the locking file (.ldb) to the folder, thus everybody else will not be able to open until that user closes the database.

I hope this works for you. I had a control freak do this to the folder that a database I created resides in, causing havoc with all users.

Rob
 
Thanks guys! I don't think I can change the security of the folder, as I do not have the permissions to do that and we have other information in there that requires full access to the folder. I was thinking about writing a macro for the ldb file last night and that sounds like a good alternative.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top