Can't call .update more than once?

  • Thread starter Maury Markowitz
  • Start date
M

Maury Markowitz

It appears that the other thread has died, so I'll try again:

I'm trying to switch providers from ODBC to OLEDB. One side-effect I have
found is that you cannot seem to call .update more than once on a newly added
row. Ie, this code will fail...

rstTemp.AddNew
rstTemp!notes = "this is a test"
rstTemp.Update
....
rstTemp!someOtherField = "some other test"
rstTemp.Update

This will cause an error on the .Update, "Identity cannot be determined for
newly inserted rows."

Has anyone seen this before? Is there some way to avoid it? Perhaps some
combination of locking flags or such?

Maury
 
D

Douglas J. Steele

The Update method saves the contents of the copy buffter to the recordset.
Once you've invoked it, you no longer have an active copy buffer.

In other words, don't issue the .Update until you've set all of the fields.
 
M

Maury Markowitz

Douglas J. Steele said:
The Update method saves the contents of the copy buffter to the recordset.
Once you've invoked it, you no longer have an active copy buffer.

This did work before though, all I've changed is the provider.

My concern here is that this might not be the only instance of this in my
code, and I'd hate to have to find out the hard way.

Maury
 
P

Paul Shapiro

While it is a little tedious, depending on how much code you have, you can
search the whole project for ".update" and review the code at each location.
Paul Shapiro
 
Top