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

runner231

New member
Local time
Yesterday, 19:53
Joined
Jul 11, 2018
Messages
5
Code:
/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[CODE]



Hi Guys, can someone please advise what is wrong with my code.  I encounter run time errror 3027.  Thank you.
 
Set rec1 = db.OpenRecordset("SELECT [Product Suppliers Name].[Product ID], [Product Suppliers Name].[Supplier] FROM [Product Suppliers Name];")

but you dont need code to do this.
a simple append query can do it.
(as long as the db is not locked)
 
Set rec1 = db.OpenRecordset("SELECT [Product Suppliers Name].[Product ID], [Product Suppliers Name].[Supplier] FROM [Product Suppliers Name];")

but you dont need code to do this.
a simple append query can do it.
(as long as the db is not locked)

Hi, what do you mean by as long as DB is not locked? Thanks
 

Users who are viewing this thread

Back
Top Bottom