[Fixed] Microsoft Access Database Engine Cannot Open Or Write To The File

While using the ODBC protocol in MS Access, you may face the error “Microsoft Access database engine cannot open or write to the file. It is already opened exclusively by another user, or you need permission to view and write its data.”

The error message indicates that there is an issue with the file or you do not have the necessary permissions to work on the Microsoft Access database engine. The error may occur when the application fails to read the file due to an incorrect file path, connection issue, incorrect permissions, etc. This error can prevent you from executing the queries in MS Access and exporting/importing data from Access to/from other sources. 

Reasons Why “Microsoft Access Database Engine Cannot Open or Write To The File” Error Occurs

There are numerous reasons why this error occurs. Some of them are as follows:

  • Access database engine is not compatible with the Microsoft Access version.
  • Data source connection issue (if you have linked tables to external sources).
  • Incorrect queries.
  • You don’t have permission to access the Access database engine.
  • Issue with the VBA code.
  • Database is opened in exclusive mode.
  • Incorrect OLE DB connection string query.
  • Corruption in database.
  • Another user is already using the file you are trying to open.
  • Issue with the Security settings (if the database file is on a network).
  • Lack of file permissions.

Methods to Fix “Microsoft Access Database Engine Cannot Open or Write To The File” Error

This error can occur if the path of the database file is incorrect. Ensure you're trying to open the file using the standard UNC path. To locate the default path of your database, go to the Default Database option in the Access Options window. Also, check and close all the Access database files windows if multiple files are open. If this doesn’t resolve the error, then follow the below methods.

Method 1: Check and Grant File Permissions

You can get the “Microsoft Access database engine cannot open or write to the file” error if you don’t have sufficient permissions to modify the database file. You can check and provide the write permissions to fix the issue. Here’s how to do so:

  • Open Windows Explorer.
  • Find the database file, right-click on it, and click Properties.

Selecting Properties

  • In the Properties window, click on the Security option.

clicking on security option

  • Select the user name, under 'Group or user names'.

Selecting user name under group or user name option

  • Check the file permissions and make sure the below options are enabled:
  • Full control
  • Modify
  • Read & Execute
  • Read
  • Write
  • If the file permission options are disabled, then enable them. To change the permissions, follow the below steps:
  • In the same Security window, click Edit.

Clicking Edit option in properties window

  • Click the Add option under "Select Users, Computer, Service Accounts or Groups," type Everyone, and click OK.

Typing everyone under select users, computer, service accounts or groups option

  • Next, allow permissions for everyone, click Apply, and then OK.

Allowing permissions for everyone

Method 2: Check and Enable Record Level Locking Option

You may get the "Microsoft Access database engine cannot open or write to the file" error if the Locking Settings are enabld in MS Access. You can check your database's locked data settings and ensure No Lock option is selected. Here's how to check and change the locking settings:

  • Open the desired database (if you are able to open it).
  • Go to File and then Options.
  • In Access options, click on Client Settings in the left pane.
  • In the Advanced section, under the Default Record locking section, select the 'No locks' option and unselect the “Open database by using record-level locking” option.

Selecting open databases by using record level locking option

  • After applying changes, click OK.

Method 3: Check the Access Database Engine Driver

Incompatible driver version can interrupt the connection between the Access database engine and external data sources, leading to the ODBC connection failure. Follow these steps to check the installed Access database engine driver on your system:

  • In the system’s search bar, type ODBC and hit the Enter key.
  • In the ODBC Data Source Administrator window, click the Drivers option.
  • You will see all the listed ODBC drivers. Look for Microsoft Access Driver (*.mdb,*.accdb) and check its version.Clicking drivers to  check versions
NOTE: Before installing the driver, make sure you have uninstalled all previously installed Access drivers from your system. 

Method 4: Check the Connection String

Some MS Access users have reported experiencing the "Microsoft Access database engine cannot open or write to the file" error when using the ADO connection string. The connection string query is used in VBA code to establish a connection between the database and external applications. This string includes all connection-related information, such as database location provider, authentication credentials, and other parameters. Make sure you are using the correct syntax of the connection string.

Method 5: Check the VBA Code

You may also encounter the error when executing the Open() and Close() functions in VBA code. These functions are used to open and close connection to the database file. Any minor mistake in the code can prevent the application from reading and writing to the database file. You can check that the file name and path provided in the function are correct.

To check and edit the VBA code in MS Access, follow these steps:

  • In the Access database file, click Database Tools and then click Visual Basic.

clicking Database Tools option and then clicking Visual Basic

  • In the Visual Basic Editor, click on the desired form under the Project Explorer pane.
  • Check the file name, file path, and other syntax errors (if any). 
NOTE: Sometimes, restrictive security settings block access to the files. You can check and change the macro settings in the Trust Center

Method 6: Repair your Database

Corruption in the database file can also prevent you from opening or writing on it. In this case, you can repair the file using the Compact and Repair tool – a built-in utility in MS Access. This utility can fix minor corruption issues in database files and help improve database performance.

If the Compact and Repair utility fails to give the expected results, use a professional Access database repair tool - Stellar Repair for Access. It is an optimal solution to repair severely damaged Access database (ACCDB/MDB) files with complete integrity. It can restore all the objects (modules, tables, macros, queries, etc.) from the corrupted database file. It can even repair split databases.

Conclusion

The error “Microsoft Access database engine cannot open or write to the file” can occur due to several reasons. This article explained various methods to get rid of this error. If corruption in the database file prevents the database engine from interacting with external sources, then use Stellar Repair for Access. It is a powerful tool that can easily repair a corrupted database and restore all its components without any data loss.



Was this article helpful?
About The Author
author image
Monika Dadool linkdin Icon

Monika Dadool is a Technical content writer at Stellar who writes about QuickBooks, Sage50, MySQL Database, Active Directory, e-mail recovery, Microsoft365, Pattern Recognition, and Machine learning. She loves researching, exploring new technology, and Developing engaging technical blogs that help organizations or Database Administrators fix multiple issues.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received