Skip to content
Auscultby NBIT
EN
Free diagnostic

Access error reference

Access error 3027: Cannot update. Database or object is read-only

The code or the form tries to save a change, but the Access database, the table or the query only accepts reading. The cause is sometimes the file, sometimes the way the application opens it.

The message

Microsoft Visual Basic box: “Run-time error '3027': Cannot update. Database or object is read-only.”
The real error box, captured in Access for Microsoft 365, in English: the code edits a record of a database opened read-only.

Cannot update. Database or object is read-only.

Access for Microsoft 365, English

On a French Access: « Mise à jour impossible. La base de données ou l’objet est en lecture seule. »

Microsoft lists, among others: a database opened read-only by OpenDatabase, a file set read-only in Windows or by the network, read-only media, or no write permission on the file over the network.

Where it shows up

In code (rs.AddNew, rs.Edit, CurrentDb.Execute "UPDATE …"), when saving a record, or when adding a row to a linked table.

Common causes

  • the file or its folder is read-only: file attribute, share permissions, database copied from a CD, an attachment or an archive that was not extracted;
  • the database is opened read-only by the code: OpenDatabase(strPath, False, True);
  • the Recordset or query is not updatable: dbOpenSnapshot, a query with grouping, a union or a non-updatable join;
  • a server linked table with no primary key: Access cannot tell which row to change, and the linked table stays read-only.

How to reproduce and check it

  1. Right-click the database file, Properties: check that “Read-only” is not ticked, then the folder permissions for the user's account.
  2. Open the table or query on its own and try to change a row: if Access refuses, the object is not updatable.
  3. In the code, look for dbOpenSnapshot or a third argument True in OpenDatabase.

How to fix it

Make the file writable: untick the read-only attribute, extract the database from the archive, grant write permission on the folder. In code, open for writing: Set db = DBEngine.OpenDatabase(strPath, False, False) and Set rs = db.OpenRecordset("Customers", dbOpenDynaset).

For a non-updatable query, write to the table directly (CurrentDb.Execute "UPDATE Customers SET …", dbFailOnError). For a server linked table, add a primary key on the server, then relink the table.

What Auscult reports

The diagnostic works on a copy of the database: your original files are never changed. An error 3027 recorded during the analysis is noted with the form or button that raises it; when it comes from a non-updatable query or Recordset, it is the application that needs fixing, not the file.

The Access error reference, code by code

Frequently asked questions

The database works on my PC but not on the server: why?

Permissions differ: on the share, the user's account must be able to write to the file and create the lock file in the folder.

Why is a query read-only?

A query with grouping, totals, a union or some joins does not let Access know which row of which table to change. Write to the table itself.

Where are the other errors in your application hiding?

The diagnostic runs on your computer, on a copy of the application, without sending the data in your tables. The health grade and the summary are free.