CancelUpdate

This method cancels changes held in memory.

Syntax

recordset.CancelUpdate

Remarks

Use the CancelUpdate method to cancel any changes made to the current recordset or to discard a newly added record. You cannot undo changes to the current record or to a new record after you call the Update method.

If you are adding a new record when you call the CancelUpdate method, the record that was current before the AddNew call becomes the current record again. ADOCE resets the EditMode property to 0.

If you have not changed the current record or added a new record, calling the CancelUpdate method generates an error. If changes were made, the EditMode property of the recordset is nonzero.

Example

The following code example shows how to use the CancelUpdate method.

Dim rs
Set rs = CreateObject("adoce.recordset")
rs.Open "MyTable", "", 1, 3
rs.AddNew 'Changes the EditMode to 2
If rs.EditMode <> 0 Then rs.CancelUpdate
MsgBox rs.EditMode
rs.Close
Set rs = Nothing