Share via

Cannot update. Database or object is read-only. (Error 3027)

Anonymous
2018-08-15T14:34:40+00:00

Dim db As DAO.Database

Dim rec1 As DAO.Recordset

Dim recFiltered1 As DAO.Recordset

Set db = CurrentDb

Set rec1 = db.OpenRecordset("SELECT [Product Suppliers Name].[Product ID], [Product Suppliers Name].[Supplier] FROM [Product Suppliers Name];", dbOpenDynaset, dbSeeChanges)

rec1.Filter = "[Product ID] = " & Me.ID

Set recFiltered1 = rec1.OpenRecordset

If (Not (recFiltered1.EOF)) Then

    rec1.Edit

    rec1![Supplier] = supplierNameSavedinProductSupplierNametable

    rec1.Update

Else

    rec1.AddNew

    rec1![Product ID] = Me.ID

    rec1![Supplier] = supplierNameSavedinProductSupplierNametable

    rec1.Update

End If

supplierNameSavedinProductSupplierNametable = ""

Set rec1 = Nothing

Set recFiltered1 = Nothing

Set db = Nothing

Hi Guys, can someone please advise what is wrong with my code.  I encounter run time errror 3027.  Thank you.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2018-08-15T20:52:58+00:00

    I'm guessing [Product Suppliers Name] is a query? Run it. Can you add rows?

    Chances are you cannot. There are entire classes of queries that are not updatable (e..g union queries and totals queries, but there are several others). So fix that first, then run your code again.

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments