This documentation is archived and is not being maintained.

OptionGroup.Locked Property

Office 2007
The Locked property specifies whether you can edit data in a control in Form view. Read/write Boolean.



expression   A variable that represents an OptionGroup object.


The default setting of the Locked property is True. This setting allows editing, adding, and deleting data.

Use the Locked property to protect data in a field by making it read-only. For example, you might want a control to only display information without allowing editing, or you might want to lock a control until a specific condition is met.


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.

Visual Basic for Applications
Sub Form_Current()
    If Me!EmployeeType = "Manager" Then
        Me!SalaryDetails.Enabled = True
        Me!PersonalInfo.Enabled = True
        Me!PersonalInfo.Locked = False
        Me!SalaryDetails.Enabled = False
        Me!PersonalInfo.Enabled = False
        Me!PersonalInfo.Locked = True
    End If
End Sub