AddNew / Update Error

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
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.
 
Back
Top