Fix Microsoft Access Database Locking After Running VBA Code
Question details
The user's Microsoft Access database becomes locked and generates an undeletable .LACCDB file after running specific VBA code, such as modifying the AppTitle property or opening recordsets.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Running VBA macros to alter database properties or interact with recordsets.
- Observed behavior
- The database locks up, often requiring a forceful closure of Access and manual deletion of the LACCDB lock file to regain entry.
Ensure you create a complete backup of your Access database (.accdb) before running any repair tools or modifying your VBA code to prevent permanent data loss.
Explicitly Close Recordsets and Objects in VBA
Improperly handled recordsets or unhandled runtime errors can leave the database in a locked state.
When VBA code runs and encounters an error or finishes without explicitly closing database objects, Access may fail to release the lock on the .laccdb file.
Ensure every Recordset.Open action in your VBA script has a corresponding Recordset.Close and Set [Recordset] = Nothing at the end of the procedure.
Use 'On Error GoTo' statements to catch errors, such as a missing AppTitle property, and route the code to a block that closes open objects before exiting the function.
Before changing properties like AppTitle via CurrentDb.Properties, write a loop to verify if the property already exists in the collection to avoid triggering a locking runtime error.

Repair Office Installation or Revert to a Previous Build
A bug in a specific build of Microsoft Office can cause unprovoked database locks during VBA execution.
Switch to WPS Office for a Lightweight Document Experience
While Microsoft Access handles complex database management, WPS Office is an excellent, free, and lightweight alternative for your core daily productivity tasks. It perfectly handles text documents, spreadsheets, and presentations with high performance and zero bloat.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install WPS Office: Run the downloaded installer file and follow the quick on-screen instructions to complete the setup.
- 3. Open Your Files: Launch WPS Office to instantly open, edit, and save your existing Microsoft Office documents without format loss.

Frequently Asked Questions
Why does an Access database generate a .laccdb file?
The .laccdb file is a locking information file created automatically when an Access database is opened. It manages concurrent user access and prevents data corruption. It is typically deleted automatically when the last user closes the database.
How do I manually remove a locked .laccdb file?
First, ensure that all instances of Microsoft Access are fully closed by checking the Windows Task Manager. Once the MSACCESS.EXE process is terminated, you can safely right-click and delete the .laccdb file from your file explorer.
Can downgrading Microsoft Office fix VBA locking issues?
Yes. Occasionally, new Office updates introduce unexpected bugs affecting VBA execution and database locking. Using the Office Deployment Tool to revert to an earlier, stable build can temporarily bypass these update-specific bugs while Microsoft develops a patch.




