recordset.addnew problem; recordset is read-only

billritz

New Member
Joined
Aug 20, 2012
Messages
23
I have two tables in an Access database, a parent and child. I have a connection, and two ADO recordsets, one each for the parent and child tables. They're both opened with a string of SQL, adOpenDynamic, adLockOptimistic, adCmdText. The logic is to see if something specified in the spreadsheet exists in the database, and, if not, add a child and its parent. I set a filter on the parent (multiple criteria) and check for EOF. When that happens, I can rsChild.addnew, but when I try to rsParent.AddNew if blows up with 80040E09: "Cannot update. Database or object is read-only" Obviously the database is not read only, as i can add a record to the child table, and I've tried adOpenKeyset just as a guess, but the same thing happens. The connection string is simple: cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\users\me\desktop\blah_blah.accdb;" Can't two recordsets share the same connection for other than reads?

So, what gives? What could cause that? Any help would be appreciated. BTW, all this is in Windows 10 & Office 2016 64-bit. Thanks in advance.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,061
Messages
6,122,922
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top