Applies To Enabled property ActiveX control, Bound Object Frame control, Chart control, Check Box control, Combo Box control, Command Button control, List Box control, Option Button control, Option Group control, Page, Subform/Subreport control, Tab control, Text Box control, Toggle Button control, Unbound Object Frame control.
Locked property ActiveX control, Bound Object Frame control, Chart control, Check Box control, Combo Box control, List Box control, Option Button control, Option Group control, Subform/Subreport control, Text Box control, Toggle Button control, Unbound Object Frame control.Description
Setting
The Enabled property uses the following settings.
Setting | Description | Visual Basic |
Yes | (Default for all controls except unbound object frames) The control can have the focus. If the control is an unbound object frame, double-clicking it executes the control's primary verb. For example, an unbound object frame could play an embedded sound object. | True (–1) |
No | (Default for unbound object frames) The control can't have the focus and appears dimmed. If the control is an option group, neither the option group nor the controls inside the option group can have the focus. | False (0) |
Setting | Description | Visual Basic |
Yes | (Default for unbound object frames) The control functions normally but doesn't allow editing, adding, or deleting data. | True |
No | (Default for all controls except unbound object frames) The control functions normally and allows editing, adding, and deleting data. | False |
Enabled | Locked | Effect |
Yes | Yes | The control can have the focus. Data is displayed normally and can be copied but not edited. |
Yes | No | The control can have the focus. Data is displayed normally and can be copied and edited. |
No | Yes | The control can't have the focus. Data is displayed normally but can't be copied or edited. |
No | No | The control can't have the focus. Control and data are disabled (dimmed). |
See Also AllowEdits property, DisplayWhen property, SetValue action, TabStop property, Visible property.
Example The following example toggles the Enabled property of a command button and the Enabled and Locked properties of a control, depending on the type of employee displayed in the current record. If the employee is a manager, then the SalaryDetails button is enabled and the PersonalInfo control is unlocked and enabled.Sub Form_Current()
If Me!EmployeeType = "Manager" Then
Me!SalaryDetails.Enabled = True
Me!PersonalInfo.Enabled = True
Me!PersonalInfo.Locked = False
Else
Me!SalaryDetails.Enabled = False
Me!PersonalInfo.Enabled = False
Me!PersonalInfo.Locked = True
End If
End Sub