Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Access.TextBox.Locked.md #1887

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions api/Access.TextBox.Locked.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ _expression_ A variable that represents a **[TextBox](Access.TextBox.md)** objec

## Remarks

The default setting of the **Locked** property is **True**. This setting allows editing, adding, and deleting data.
The default setting of the **Locked** property is **False**. 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.
Use the **Locked** property to protect data in a field by making it read-only. For example, you might want a textbox to only display information without allowing editing, or you might want to lock a textbox until a specific condition is met.


## 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, the **SalaryDetails** button is enabled and the **PersonalInfo** control is unlocked and enabled.
The following example toggles the **Enabled** property of a command button and the **Enabled** and **Locked** properties of a textbox, depending on the type of employee displayed in the current record. If the employee is a manager, the **SalaryDetails** button is enabled and the **PersonalInfo** textbox is unlocked and enabled.

```vb
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
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
```

Expand Down