Error "Cannot lock file " while opening the MS Access database file
As a practical instance, you have an Access database (Accounts) saved on the server. However, when you attempt to open the database file, the below error message pops up:
"Cannot lock file"
The error message does not allow you to open the Accounts database file and further makes all the records inaccessible. Additionally, you receive the same error message each time you attempt to open the database file.
Cause:
Few main causes for the above error message are discussed below:
Accounts database crashed out (corrupted)
You have no read/write privileges on the Accounts database
Resolution:
In case of no read/write privileges, you will need to request the administrator to assign you the privileges. However, in case of Access database corruption, you will need to use an inbuilt repair utility known as "Compact and Repair." You will need to take the below steps to use the repair utility:
1.Select Database Utilities under Tools drop down list. Click Compact and Repair Database.
2.Click Compact after searching and selecting the database in the ´Database to Compact From´ dialog box.
3.Select a new folder location for the file in the ´Compact Database Into´ dialog box.
4.Provide a unique name to the file. Click on Save.
In case, the Accounts database remains corrupted even after using the repair utility, then you will need to use a powerful Access Recovery software. Such access database repair tools are built with rich graphical user interface and use high end scanning methods to repair the corrupted Access database files (.accdb and .mdb).

