error 3073 Must use an updateabl query

dogdays

Active Member
Joined
Apr 28, 2008
Messages
434
Office Version
  1. 2007
win 7 64 bit access 2007

I am trying to insert selected rows of a list box. The insert works for the first few rows, then I get error 3073.
All files involved are non read only status. The following code shows the first insert and the 5th insert.
When I get 3073 and restart Access the insert that triggered the 3073 works quite nicely.

Code:
'  Query 1
INSERT INTO tblFriends(nElectionYear, tLeaderVoterID, tVoterID, bExclusive) VALUES (2016,'21001215138','21001357676',False)

'  query 5 (triggered 3073)
INSERT INTO tblFriends(nElectionYear, tLeaderVoterID, tVoterID, bExclusive) VALUES (2016,'21001215138','28001145587',False)

tia Jack
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
The sql is fine, unless you have a primary key violation (which is not apparently the case). Make sure you are compacting and repairing the db on a regular basis. Sometimes with forms you can rebuild the form as a worst case scenario (it's not clear what you are actually doing with a listbox, btw, since the code doesn't refer to a listbox at all).
 
Last edited:
Upvote 0
Thanks for the reply. No primary key violations.
The VALUES clause is populated from a row in the listbox..
Will set db to compact and repair on close.

Jack
 
Upvote 0
There's not a whole lot I can recommend to keep Access DB's safe except compact and repair regularly, watch over it careful if it is possible it might actually grow to become too large (over 2Gb) so you are ready for that eventuality. Split your database. And always have a backup strategy in place.

Not sure how you get from a listbox value to a raw value such as 'xxx' - there must be some code you haven't posted.
 
Upvote 0
Thanks Xenou, I compacted the db and all is well.
I set the db to compact on close. This is a split db.
How can I automatically compact the back end when the front end closes?

tia Jack
 
Upvote 0
that I don't know. I never use that automatic feature - I just run compacts at night once a week or so.
 
Upvote 0

Forum statistics

Threads
1,221,813
Messages
6,162,126
Members
451,743
Latest member
matt3388

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