Enabled, Locked Properties 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