When you try to open a database, you may encounter this error message:
Could not use [Database Name]; file already in use.
This error occurs if another user (or instance of Access) has opened up the database exclusively and you try to open it. Maybe the other user opened the database in exclusive mode or made some modifications such as editing modules, which put the database in exclusive mode.
However, that may not be the case. This error can occur even if the other user has the database opened without opening it exclusively. What's going on? Why would the second instance think it's being opened exclusively?
It turns out that another cause of this error is not immediately obvious and is related to workgroup security files. This applies to MDB files (not ADP or ACCDB formats). If two instances of Microsoft Access (DAO database engine) are using different system MDW files, a conflict may occur where the database appears to be exclusively locked by the other instance. The MDW file used by your instance of Access can be checked in VBA by examining the value of DBEngine.SystemDB.
Another copy of Access or DAO may have that database opened using another MDW file causing this conflict. This can come from another instance of MS Access, a Microsoft Access add-in or library reference, a VBA Add-in, or other program such as VB6, .NET, etc. that's connecting to that database.
To avoid this, if you’re using workgroup security, make sure every instance is pointing to the same shared MDW file. This is often defined in the shortcut used to launch Microsoft Access, or if you are opening a different database programmatically within your VBA code.
Visit our Microsoft Access Error Number and Error Description Reference site for a complete list of Microsoft Access error numbers, many with links to resources explaining and resolving them.
If you're interested in seeing who's going in and out of your database in real time, check out our Total Access Admin program. It'll let you monitor multiple databases across your network to see when users enter and exit your database and flag instances where connections are dropped suspiciously. Free Trial.