Cannot Update. Database or object is read-only (1 Viewer)

GBalcom

Much to learn!
Local time
Today, 02:22
Joined
Jun 7, 2012
Messages
459
Had a nice working database. Changed some code, and added one field to a table in the back end. Refreshed the table links. Now when my code tries to edit a recordset based on a query I have not touched, which was always updateable, it shouts the following error:

Cannot update Database or object is read-only.

Any ideas why? What to do to resolve it? Sounds eerily similar to this post https://access-programmers.co.uk/forums/showthread.php?t=170950, but they don't show how they fixed it. :banghead:
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:22
Joined
Oct 29, 2018
Messages
21,455
Hi. Is there any way you could post a demo copy of your db?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:22
Joined
Feb 28, 2001
Messages
27,148
In general, when a previously working query stops working with the "can't update" message and the ONLY change was to add a field from a table, the issue is that the added field somehow introduces ambiguity into the mix. For UPDATE queries, Access really wants to uniquely identify the records it will update. If it happens that the added field has the effect of making Access unsure of which JOIN combination to update (because the UPDATE query's WHERE clause is not specific for the fields from the CHILD table, perhaps), you find yourself with that message. Sometimes it is very hard to find.

See also this article: http://allenbrowne.com/ser-61.html
 

GBalcom

Much to learn!
Local time
Today, 02:22
Joined
Jun 7, 2012
Messages
459
Thanks Gentlemen. Not sure what the problem was. I realized this morning after some coffee that the field I added was in a table that wasn't even part of this query. Honestly, I'm wondering if this was a silent bug, that hadn't shown itself yet in the 2 months I've had this code running.

either way, I pulled the update away from the query and am doing it from a private sub directly in the recordset of the affected table. Thanks for the help!
 

Users who are viewing this thread

Top Bottom