Enabled, Locked Properties
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The Enabled property specifies whether a control can have the focus in Form view.
The Locked property specifies whether you can edit data in a control in Form view.
Setting
The Enabled property uses the following settings.
Setting | Visual Basic | Description |
---|---|---|
Yes | (True (1) | Default for all controls except unbound object frames) The control can have the focus. If the control is an unbound object frame, double-clicking it executes the control's primary verb. For example, an unbound object frame could play an embedded sound object. |
No | False (0) | (Default for unbound object frames) The control can't have the focus and appears dimmed. If the control is an option group, neither the option group nor the controls inside the option group can have the focus. |
The Locked property uses the following settings.
Setting | Visual Basic | Description |
---|---|---|
Yes | True | (Default for unbound object frames) The control functions normally but doesn't allow editing, adding, or deleting data. |
No | False | (Default for all controls except unbound object frames) The control functions normally and allows editing, adding, and deleting data. |
You can set these properties by using a form's property sheet, a macro, or .
Remarks
Use the Enabled property to enable and disable controls. For example, in Form view you can disable a command button until you have changed data in a text box control. You can then use the control's event to call an event procedure or macro to enable the command button.
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.
You can combine the Enabled and Locked property settings to achieve the following effects.
Enabled | Locked | Effect |
---|---|---|
Yes | Yes | The control can have the focus. Data is displayed normally and can be copied but not edited. |
Yes | No | The control can have the focus. Data is displayed normally and can be copied and edited. |
No | Yes | The control can't have the focus. Data is displayed normally but can't be copied or edited. |
No | No | The control can't have the focus. Control and data are disabled (dimmed). |
The TabStop property can be combined with the Enabled property to prevent the use of the TAB key to select a command button, while still allowing use of the button by clicking it. Setting the TabStop property to No means that the command button won't be in the tab order. However, if the Enabled property is set to Yes, then you can still click the command button.
To allow edits to an embedded or linked object in an unbound object frame, you must set the Enabled property for the unbound object frame to Yes and the Locked property to No.