When I tried to open one of my main Access databases today, I got the alarming message, “The database ‘MyData’ is read-only. You won’t be able to save changes made to data or object definitions in this database.”
I closed it, and tried to open it again, making sure that I hadn’t accidentally selected the Read Only option.
More Troubleshooting Steps
A Google search turned up some dire warnings that this could be a sign of corruption, so I created a new database, imported all the tables, queries, forms, and everything else, and all seemed well.
So, I renamed the old version, and gave the new version the same name as the previous one, so my Windows Explorer shortcuts and connections would work.
Is It Locked?
As soon as I opened the new copy of the database, the “read-only”problem was back. So, I decided to look for “.ldb” files.
When an Access database is open, it automatically creates an ldb file. This file has the same name as the database, with an “.ldb” or “.laccdb” extension. Later, when the database closes, that ldb file is automatically deleted.
- NOTE: Access uses an ldb file to keep track of which records in the database are currently locked, and by whom. (Records are locked while someone is editing the record.) Maybe you’ve seen a “Write Conflict” warning message when you try to save a record, because someone else is changing that record, or a record close to it.
- You can read more about these Access locking files on the Microsoft website.
Sometimes those ldb files don’t get deleted, when a database closes, and that can cause problems.
So, I looked for errant ldb files, that were mistakenly telling the database someone else had it open. There was nothing.
Connection Problem
Finally, it dawned on me — connections could be the problem.
I had an Excel file open, and it queried the database, so maybe that was the problem. I closed the Excel , re-opened the database, and it worked fine.
Later, if I tried to open the database when the Excel file was open, the database was read only.
Fix the Connection
Well, I don’t have the two files (Excel and Access) open simultaneously too often, but I wanted to have that option available.
So, I checked the connection strings for the queries and found that they included this setting:
- Mode=Share Deny Write
I changed the setting to this instead:
- Mode=Read
and the files now live in harmony (so far).
Where Are the Connection Strings?
To find the connection strings in Excel:
- Click the Data tab on the Ribbon, and then click Connections.
- On the Workbook Connections dialog box, click a connection name in the list
- Click the Properties button, to open the Connection Properties dialog box.
- Click the Definition tab, and edit the Connection String.
- The strings that I edited were for Provider=Microsoft.ACE.OLEDB.12.0
- The Mode setting might not appear in other types of connections.
Why Share This?
This information is probably of no interest to you, unless you landed here in a Google search for this error message:
- “You won’t be able to save changes made to data or object definitions in this database”.
But, one day in the future, I might run into this error again, and maybe I’ll find my own solution when I do a Google search.
Don’t laugh — it’s happened to me before! (more than once!)
___________