ADO » Recordset » CancelUpdate

Syntax:
recordsetobject.CancelUpdate

Used to cancel any changes made to the current row or to cancel the addition of a new row to a Recordset.This must be done before performing an Update.

The CancelUpdate method is called to cancel any pending changes made to the current record including a newly added record. This can only be done before the Update method is called. Afterwards is too late since the record is saved and has become part of the database. The previous record will become the new current record.

If no changes have occurred to the current record, then calling this method will generate an error.

Examples

Code:
If MsgBox("Save All Changes", vbYesNo) = vbYes Then
   objRecordset.Update
   MsgBox "All Changes Updated"
Else
   objRecordset.CancelUpdate
   MsgBox "All Changes Cancelled"
End If

See Also: