EditMode Property

Recordset.EditMode Property (DAO)

Office 2013 and later

Last modified: June 29, 2011

Applies to: Access 2013 | Office 2013

In this article

Returns a value that indicates the state of editing for the current record.

expression .EditMode

expression A variable that represents a Recordset object.

The return value is a Long that indicates the state of editing. The value can be one of the EditModeEnum constants.

The EditMode property is useful when an editing process is interrupted, for example, by an error during validation. You can use the value of the EditMode property to determine whether you should use the Update or CancelUpdate method.

You can also check to see if the LockEdits property setting is True and the EditMode property setting is dbEditInProgress to determine whether the current page is locked.

This example shows the value of the EditMode property under various conditions. The EditModeOutput function is required for this procedure to run.

Sub EditModeX() 
 Dim dbsNorthwind As Database 
 Dim rstEmployees As Recordset 
 Set dbsNorthwind = OpenDatabase("Northwind.mdb") 
 Set rstEmployees = _ 
 dbsNorthwind.OpenRecordset("Employees", _ 
 ' Show the EditMode property under different editing 
 ' states. 
 With rstEmployees 
 EditModeOutput "Before any Edit or AddNew:", .EditMode 
 EditModeOutput "After Edit:", .EditMode 
 EditModeOutput "After Update:", .EditMode 
 EditModeOutput "After AddNew:", .EditMode 
 EditModeOutput "After CancelUpdate:", .EditMode 
 End With 
End Sub 
Function EditModeOutput(strTemp As String, _ 
 intEditMode As Integer) 
 ' Print report based on the value of the EditMode 
 ' property. 
 Debug.Print strTemp 
 Debug.Print " EditMode = "; 
 Select Case intEditMode 
 Case dbEditNone 
 Debug.Print "dbEditNone" 
 Case dbEditInProgress 
 Debug.Print "dbEditInProgress" 
 Case dbEditAdd 
 Debug.Print "dbEditAdd" 
 End Select 
End Function 

© 2016 Microsoft