ADO CancelUpdate Method

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO CancelUpdate Method

Applies To: Fields Collection (ADO)  and Recordset Object (ADO)

The CancelUpdate method 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.

Recordset object

This method is used to cancel any changes made to the current record or to a newly added record. This method can only be called before the Update method of the Recordset is called.

Record object

This method is used to cancel any changes (insertions or deletions) of Field objects.

Syntax

objRecordset.CancelUpdate
objRecord.Fields.CancelUpdate
 

Example


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