Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3218

Status
Not open for further replies.

cruzer330

Programmer
Nov 29, 2000
12
US
I have a table with about 2500 records in it. In VBA, I am reading in a recordset, performing calclations and add more information to each record. Following is the code. The problem is that about half way through, I get an error

Run-time error '3218':
Couldn't update

set db = currentdb
set rec = db.openrecordset

do while not rec.eof

[calculations]

rec.edit
[new info]
rec.update

loop
 
I don't know if this is causing the problem or not, but you need to have a rec.movenext in your loop:

set db = currentdb
set rec = db.openrecordset

do while not rec.eof

[calculations]

rec.edit
[new info]
rec.update

rec.movenext ' move to the next record

loop

Mike Rohde
rohdem@marshallengines.com
 
It might be caused by assigning an illigal value to a field, ie a nullstring where it's not allowed, null value to a numeric field etc.

Roy-Vidar
 
Hi,
I take it you have the correct arguments after the
Code:
set rec = db.openrecordset
it shouldn't let you compile without any, but if you have arguments after this can you post what they are as some types of recordset are not updateable.
Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top