Cannot Update - Database or Object is Read Only (adding attachments to sharepoint) (1 Viewer)

Isaac

Lifelong Learner
Local time
Yesterday, 22:02
Joined
Mar 14, 2017
Messages
8,777
I have some code that allows a user to add one attachment to a Sharepoint list. Sometimes, but not always, and seemingly at random (or I can't figure out a pattern), the error will be raised "Cannot update. Database or object is read-only". Then I'll go in to the same screen and it will work for me - just kind of hit or miss.

Is there anything about this code that would give rise to that, that anyone can tell? There is nothing else in the Sub prior to this point that messes with this record in any way - this is the first type of edit of any kind.

Code:
Set rsMain = db.OpenRecordset("select col1,attachments from [tablename] where id=" & Me.listRecords.Column(0))
rsMain.Edit
Set rsAttachments = rsMain.Fields("Attachments").Value
rsAttachments.AddNew
rsAttachments.Fields("FileData").LoadFromFile Me.txtPath.Value
rsAttachments.Update '********************************************this is where the code debugs when they get the error
rsMain.Fields("col1") = strFileName
rsMain.Update
rsMain.Close
Set rsMain = Nothing
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 06:02
Joined
Jul 9, 2003
Messages
16,280
It looks like your post has been missed, so I am bumping it up the list so that it gets a second look.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:02
Joined
Feb 28, 2001
Messages
27,172
Because you are working remotely AND on a Sharepoint setup, you have to consider permissions and the fact that Sharepoint isn't known to be super great for sharing. Is there a chance that someone else is doing another update just before the person who gets the problem? In which case, it may be that the Sharepoint file isn't happy about actually sharing simultaneously? We have others here who are better at Sharepoint so I will defer if they say it can't happen. However, I thought I had seen an article that points out Sharepoint's non-sharing method of sharing.

If Access says it cannot do something because some file is Read-Only, it is ALMOST always either a permissions issue or a file-lock issue. If it fails for person X and moments later works for you, the question would be ... if person X exits and then re-enters the app and tries again, does it fail a second time?
 

Users who are viewing this thread

Top Bottom