EditMode Property

Indicates the editing status of the current record.

Return Value

Returns an EditModeEnum value.

Remarks

ADO maintains an editing buffer associated with the current record. This property indicates whether changes have been made to this buffer, or whether a new record has been created. Use the EditMode property to determine the editing status of the current record. You can test for pending changes if an editing process has been interrupted and determine whether you need to use the Update or CancelUpdate method.

In immediate update mode the EditMode property is reset to adEditNone after a successful call to the Update method is called. When a call to Delete does not successfully delete the record or records in the data source (for example, because of referential integrity violations), the Recordset remains in edit mode (EditMode = adEditInProgress). Therefore, CancelUpdate must be called before moving off the current record (for example with Move, NextRecordset, or Close).

In batch update mode (in which the provider caches multiple changes and writes them to the underlying data source only when you call the UpdateBatch method), the value of the EditMode property is changed when the first operation is performed and it is not reset by a call to the Update method. Subsequent operations do not change the value of the EditMode property, even if different operations are performed. For example, if the first operation is to add a new record, and the second makes changes to an existing record, the property of EditMode will still be adEditAdd. The EditMode property is not reset to adEditNone until after the call to UpdateBatch. To determine what operations have been performed, set the Filter property to adFilterPending so that only records with pending changes will be visible and examine the Status property of each record to determine what changes have been made to the data.

Note

EditMode can return a valid value only if there is a current record. EditMode will return an error if BOF or EOF is true, or if the current record has been deleted.

Applies To

Recordset Object (ADO)

See Also

CursorType, LockType, and EditMode Properties Example (VB)
CursorType, LockType, and EditMode Properties Example (VC++)
AddNew Method (ADO)
Delete Method (ADO Recordset)
CancelUpdate Method (ADO)
Update Method