Solved Run-time error '3027' Cannot update. Database or object are read only. (1 Viewer)

5hadow

Member
Local time
Today, 14:07
Joined
Apr 26, 2021
Messages
84
Good day everyone,

I have the following error: Run-time error '3027' Cannot update. Database or object are read only. when using a certain form.
On "Debug" it stops on following line of code: (Me.Dirty = False)
Code:
Private Sub findWI()
    With Me.RecordsetClone
        If Not IsNull(lstWI.Value) Then
            If Me.Dirty Then
                Me.Dirty = False
            End If
            .FindFirst "[Work Instructions].[ID] = " & lstWI.Column(0) & ""
            If Not .NoMatch Then
                Me.Bookmark = .Bookmark
                lstWI.Value = ID
            End If
        End If
    End With
End Sub

Please note that code ran fine before with no issues. Not sure what changed. Form is based on a query which does not have a "new record" option. (as in, cannot insert a new record in query) I tried changing it from Dynaset to inconsistent updates. Now the query does have an option to insert new information, but I still get the same error.
Any ideas what could be wrong from that code above?
 

Minty

AWF VIP
Local time
Today, 19:07
Joined
Jul 26, 2013
Messages
9,371
If the query the sub-form is based on isn't updatable then you can't save the record. Simple as that.
You can test this by simply opening the query in datasheet view and trying to edit the values.
 

bastanu

AWF VIP
Local time
Today, 11:07
Joined
Apr 13, 2010
Messages
1,207
You need to do the same to the form's recordset type (in design view change it to Dynaset Inconsistent Updates).

Cheers,
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:07
Joined
Feb 28, 2001
Messages
23,151
If it only happens on a specific form, it isn't the database. It is something about the form. If other forms can perform updates, then it must be due to something done either in the VBA code in the form's class module or it must be something to do with the form's .RecordSource, which is of course either a table or query name reference or an SQL string.

Therefore, it isn't likely to be due to that pesky Windows bug that is making things not updateable. That would affect all forms. The fact that it does not stop other forms means it isn't a Windows problem either.

You say this used to run but now it doesn't. So, ... what did you change recently? Consider the form, its VBA code, and the tables or queries associated with the form. It might be due to an altered relationship or a changed table property for a table that is part of a query. Might be a change to the query itself. But with computer actions, it is always true: If behavior changed, the contributors to that behavior must have changed. You suggest that the query has the option set up to disallow INSERT operations. Was that always set up that way? Why would you expect that a form based on a query could do something that the query itself wasn't allowed to do?
 

Cherylodge

New member
Local time
Today, 23:37
Joined
Mar 10, 2022
Messages
20
Good day everyone,

I have the following error: Run-time error '3027' Cannot update. Database or object are read only. when using a certain form.
On "Debug" it stops on following line of code: (Me.Dirty = False)
Code:
Private Sub findWI()
    With Me.RecordsetClone
        If Not IsNull(lstWI.Value) Then
            If Me.Dirty Then
                Me.Dirty = False
            End If
            .FindFirst "[Work Instructions].[ID] = " & lstWI.Column(0) & ""
            If Not .NoMatch Then
                Me.Bookmark = .Bookmark
                lstWI.Value = ID
            End If
        End If
    End With
End Sub

Please note that code ran fine before with no issues. Not sure what changed. Form is based on a query which does not have a "new record" option. (as in, cannot insert a new record in query) I tried changing it from Dynaset to inconsistent updates. Now the query does have an option to insert new information, but I still get the same error.
Any ideas what could be wrong from that code above?
Hello,

Runtime errors may be annoying, but there are many repair options available to fix these errors:
  1. Close Conflicting Programs
  2. Update/Reinstall Conflicting Programs
  3. Update the Virus protection program or install the latest windows update
  4. Re-install Runtime libraries
  5. Run Disk Clean-up
  6. Re-install your graphics driver
  7. Internet Explorer related runtime errors
Surf on google to find the process for these repair methods.

Best Regards,

Cheryl
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:07
Joined
Feb 28, 2001
Messages
23,151
I would also take a hard look at the form's .Recordsource as Minty suggested. BUT if there is a formal relationship involved and a JOIN query is the form's .Recordsource, see if the JOIN or the relationship is causing an ambiguity in the update process. Access will not update something if it cannot uniquely identify what is being updated.
 

Users who are viewing this thread

Top Bottom