AllowEditing, DefaultEditing Properties

Applies To

Form.

Description

  • AllowEditing — determines whether the Allow Editing command on the Records menu is enabled when you open a form in Form view or Datasheet view.
  • DefaultEditing — determines whether a form opens to allow editing, read-only access, data entry (you can only enter new records), or editing of existing records only (you can’t enter any new records).

Note The AllowEditing and DefaultEditing properties are included in this version of Microsoft Access only for compatibility with previous versions. It is recommended that you use the AllowEdits, AllowAdditions, and DataEntry properties instead.

Setting

The AllowEditing property uses the following settings.

Setting Description
Available (Default) The Allow Editing command on the Records menu is enabled.
Unavailable The Allow Editing command is disabled.


The DefaultEditing property uses the following settings.

Setting Description
Allow Edits (Default) You can edit, add, or delete records in the form’s table or query.
Read Only You can’t edit, add, or delete records until you choose the Allow Editing command.
Data Entry You can add new records. Existing records aren’t available.
Can’t Add Records You can edit or delete existing records. You can’t add new records.


You can set these properties in the form’s property sheet, a macro, or Visual Basic.

Remarks

Use these properties to design forms for data entry or for read-only access. You can combine them to establish the following conditions.

DefaultEditing AllowEditing Description
Allow Edits Available or Unavailable All records are available. You can edit, add, or delete records.
Read Only Available All records are available. You must choose the Allow Editing command to edit, add, or delete records.
Unavailable All records are available. You can’t edit, add, or delete records.
Data Entry Available No existing records are available. You can add new records.
Unavailable No existing records are available. You can’t edit, add, or delete records.
Can’t Add Records Available or Unavailable All existing records are available, and you can edit or delete them. You can’t add new records.


Note The Data Entry setting doesn’t completely prevent you from viewing records when using the form. If the AllowFilters property is set to Yes, you can click Remove Filter/Sort on the Records menu to display all records.

See Also

AllowAdditions Property, AllowEdits Property, DataEntry Property.

Example

The following example disables the Records menu’s Allow Editing command and specifies that the form open in data entry mode.


Sub Form_Open(Cancel As Integer)
    Const conDataEntry = 3
        Me.AllowEditing = False      ' Disable Records menu option.
        Me.DefaultEditing = conDataEntrySub