AddNew / Update Error

G

Guest

When trying to trap for records that are not getting written to a table, I am
receiving this error: "Update or CancelUpdate without AddNew or Edit". After
the .Update line, I am doing the following:
..Update
If Err.Number <> 0 Then
'MsgBox Err.Number & " " & Err.Description
.CancelUpdate
On Error Resume Next
With rstReportErrors
.AddNew
.Fields("ClientID") = intID
.Fields("Name") = strName
(More Lines...)
.Update
End With

Not quite sure why I am getting this. Any suggestions would be appreciated.

Alton
 
J

John Nurick

It looks as if you're expecting CancelUpdate to *undo* the previous
Update.

It doesn't do this. It only only cancels a *pending* update, i.e. one
that has been initiated with AddNew or Edit but has not yet been
committed with Update.
 
G

Guest

Thanks. I will revisit my process.

Alton

John Nurick said:
It looks as if you're expecting CancelUpdate to *undo* the previous
Update.

It doesn't do this. It only only cancels a *pending* update, i.e. one
that has been initiated with AddNew or Edit but has not yet been
committed with Update.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top