Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-15-2018, 06:47 AM   #1
runner231
Newly Registered User
 
Join Date: Jul 2018
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
runner231 is on a distinguished road
Cannot update. Database or object is read-only. (Error 3027)

[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.

runner231 is offline   Reply With Quote
Old 08-15-2018, 06:56 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,136
Thanks: 0
Thanked 683 Times in 668 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Cannot update. Database or object is read-only. (Error 3027)

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)
Ranman256 is offline   Reply With Quote
Old 08-15-2018, 07:13 AM   #3
runner231
Newly Registered User
 
Join Date: Jul 2018
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
runner231 is on a distinguished road
Re: Cannot update. Database or object is read-only. (Error 3027)

Quote:
Originally Posted by Ranman256 View Post
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

runner231 is offline   Reply With Quote
Old 08-15-2018, 12:51 PM   #4
bastanu
Registered User
 
Join Date: Apr 2010
Location: Kelowna, Canada
Posts: 148
Thanks: 1
Thanked 48 Times in 48 Posts
bastanu is on a distinguished road
Re: Cannot update. Database or object is read-only. (Error 3027)

cross-post: http://www.accessforums.net/showthread.php?t=73336

bastanu is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Run-time error 3027: Cannot Update. Database or object is read-only. lespritdelescalier Modules & VBA 6 02-17-2017 07:43 AM
Error 3027 Cannot Update. Database or object is read-only shenty General 10 09-07-2016 09:40 AM
accde - Error 3027. Cannot update. Database or object is read-only. gpapaiko General 2 10-02-2013 01:26 AM
Error 3027 Cannot Update. Database or object is read-only DataChick Modules & VBA 9 02-27-2010 08:56 AM
Runtime Error 3027 Cannot Update, Database or Object is read-only Thinh General 2 12-21-2006 09:54 PM




All times are GMT -8. The time now is 04:08 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World