Table of contents
TOC
折叠目录
展开目录

TextBox.Locked 属性 (访问)TextBox.Locked Property (Access)

office 365 dev account|上次更新日期: 2018/3/12
|
1 参与者

Locked属性指定是否可以编辑控件在窗体视图中的数据。The Locked property specifies whether you can edit data in a control in Form view.读/写 BooleanRead/write Boolean.

语法Syntax

expression.expression.LockedLocked

表达式_一个表示文本框对象的变量。_expression A variable that represents a TextBox object.

注解Remarks

Locked属性的默认值设置为FalseThe default setting of the Locked property is False.此设置允许编辑、 添加和删除数据。This setting allows editing, adding, and deleting data.

使用Locked属性可以保护使其成为只读字段中的数据。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.如果员工是经理,然后启用 SalaryDetails 按钮,并 PersonalInfo 控件已锁定并启用。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

另请参阅See also

概念Concepts

TextBox 对象TextBox Object

© 2018 Microsoft