Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (36 sloc) 1.57 KB
title keywords f1_keywords ms.prod api_name ms.assetid ms.date localization_priority
TextBox.Locked property (Access)
vbaac10.chm11061
vbaac10.chm11061
access
Access.TextBox.Locked
025b88db-7409-4cb6-bcc0-c72a6a3850d3
02/22/2019
Normal

TextBox.Locked property (Access)

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

Syntax

expression.Locked

expression A variable that represents a TextBox object.

Remarks

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.

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.

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

[!includeSupport and feedback]

You can’t perform that action at this time.