Microsoft Access
Access says “file already in use”: causes and fixes
The database opens for only one person, or does not open at all? The lock file is almost always to blame: here is how to fix it.
In short
- When a database is opened, Access creates a lock file next to it that lets several people use it at the same time.
- If a user cannot create files in the folder, Access does not create the lock file and opens the database in exclusive mode.
- Whoever opens the database in exclusive mode locks everyone else out until they close it.
- A lock file left behind after an interrupted session can be deleted, but only with Access closed on every computer.
- In late 2021 an Office update caused these errors with files on a network: Office must be updated on every computer.
The messages and what they mean
The errors almost always appear when the database sits in a shared network folder. Microsoft documents them as follows:
- “Could not use … file already in use”: Access says the file is already in use and does not open it.
- “Could not lock file”: Access cannot lock the file, meaning it cannot keep track of who is using it.
- No message, but only one person at a time: the first user works, and whoever comes next gets the error even though nobody chose exclusive mode.
Behind all three there is almost always the lock file, a small file that Access manages by itself.
How the lock file works
When someone opens the database, Access creates a file in the same folder with the same name and the .laccdb extension (.ldb for old .mdb files). It records there who is using the database, so several people can work together without overwriting each other. When the last user closes Access, the lock file disappears.
- 1The first user opensthe database on the network
- 2Lock filecreated in the same folder
- 3The others come inrecorded in the lock file
- 4The last one closesthe lock file disappears
If this mechanism jams, the database becomes one person at a time. There are four causes.
Cause 1: folder permissions
This is the most frequent cause. To create the lock file, every user must be able to read, write and create files in the database folder. Microsoft explains that if a user lacks permission to create files, Access opens the database for them in exclusive mode: from that moment everyone else gets the error.
Check the permissions
Ask whoever manages the server to check that every user of the database can read, write and create files in the folder, not just modify the file.
Check sharing and security
Both the network share permissions and the folder permissions count: the more restrictive of the two applies.
Try again with everyone out
Have everyone close Access, then open the database again from two computers: the lock file should appear and the second user should get in.
Keep the database in a dedicated folder: it is easier to give the right permissions only to the people who use it, without touching the rest of the share.
Cause 2: someone opened it in exclusive mode
Access can open a database in exclusive mode: whoever does so locks everyone else out until they close it. It happens more often than you might think:
- Access options: under File › Options › Client Settings, the Default open mode must be Shared. Check it on every computer.
- Opening it that way by hand: the Open dialog box lets you choose exclusive mode. Anyone who does this for maintenance must remember to close the database afterwards.
- Compact and Repair needs exclusive access: run it when nobody is working, otherwise anyone who comes in during the operation finds the database locked.
Cause 3: a lock file left behind
If a computer shuts down or loses the network with the database open, the lock file can stay in the folder and still list that user. Access often deals with it by itself, but sometimes it prevents the database from opening.
Have everyone close Access
Check on every computer, including any left on overnight, that Access is closed.
Find who still has it open
Whoever manages the server can see which users have the database open in Computer Management, under Shared Folders › Open Files, and can close a session that was left hanging.
Delete the lock file
Only when nobody is using the database, delete the
.laccdbfile: Access creates it again the next time the database opens. If Windows will not let you delete it, someone is still using it.
Do not close sessions from the server while someone is writing to the database: it is one of the ways an Access file gets damaged. If it has already happened, the guide to a corrupted Access database explains how to recover it.
Cause 4: an Office update
In late 2021, some Office updates caused exactly these errors, “file already in use” and “Could not lock file”, with databases in a network folder. Microsoft fixed the problem with later updates.
If the error suddenly appears on a database that used to work, check that every computer that uses Access has Office up to date: Microsoft recommends updating all of them, not just the one showing the error.
Would you like an opinion on your case?
Send us the file: within 48 hours you receive a free written assessment, even if the answer is that a small fix is enough.
If the problem keeps coming back
A shared Access database copes with a few users on a wired network. If locks and errors come back every week, there are usually too many users, the network is unstable or the database is not split: the guide to Access slow on a network explains how to split it.
When that is not enough, the route is to move the data to SQL Server, which handles simultaneous access without lock files, or to bring the program to the web. Here is how we turn Access databases into web applications.
Frequently asked questions
Can the .laccdb file be deleted?
Yes, but only when nobody has the database open: Access creates it again the next time the database opens. If Windows will not let you delete it, someone is still using it.
Why does the lock file stay even with Access closed?
Usually because a computer shut down or disconnected with the database open, or because the last user does not have permission to delete files in the folder.
Is the lock file created with a single user too?
Yes, every time the database opens. With a single user it causes no problems, but if the folder does not allow it to be created, the database opens in exclusive mode.
Can a database on OneDrive cause these errors?
Yes. Microsoft advises against opening Access databases from OneDrive or SharePoint: syncing can lock the file or damage it. The database should be kept in a network folder.
How can you tell who has the database open?
Whoever manages the server can see it in Computer Management, among the open files of the shared folders. The lock file lists the names of the connected computers, but it can also include people who disconnected abruptly.
Sources
- Microsoft: unable to open an Access database on a server
- Microsoft: error in Access when opening a database on a network file share
- Microsoft: compact and repair a database
- Microsoft: ways to share an Access desktop database
Official Microsoft pages.