Lesson 7.6. Working with Control Properties
Figure 7-12. Here the Properties dialog box
Every control on a formevery text box, every label, and every check boxhas a set of properties that you can modify. A property is an attribute that defines an object's appearance, behavior, or characteristics. For example, the properties of a house would be its color, square footage, and shape. A property for a field on a form might be the number of decimal places displayed or the default value for the field. Because you can almost always change an object's properties, you can think of them as the object's settings.
Different types of controls have different properties. For example, label controls have a Caption property that determines the text that is displayed in the label, while text box controls have a Control Source property that determines which field is displayed in the control. Most controls have several dozen different properties or settings. Fortunately, Access organizes these properties into different categories, as shown in Table 7-3.
There are several ways to view the properties for any object:
Right-click the control and select Properties from the shortcut menu.
Select the control and click the Properties button on the toolbar.
Select the control and select View Properties from the menu.
This lesson explains how to view and change a control's properties.
Open the frmCustomers form in Design view.
Here's one way to view the properties for a control:
Select the LastName text box control and display its properties by clicking the Properties button on the Form Design toolbar.
Tip: Other ways to view a control's properties are to right-click the control and select Properties from the shortcut menu, or select the control and select View
The Properties dialog box appears and displays the properties for the LastName text box control, as shown in Figure 7-12. To change a property, simply find and click the appropriate property box and make the changes. Some property boxes will display one of the following buttons when clicked:
Move on to the next step and we'll try changing one of the LastName text box control's properties.
Click the Format tab, if necessary, then find and click in the Back Style box and select Transparent from the menu.
Note: Most controls have dozens and dozens of properties. You will often have to click the appropriate tab and then do some scrolling to find the property box that you're looking for.
The back of the LastName text box control becomes transparent and displays the gray background of the underlying form. The transparent Back Style property of the LastName text box control looks out of place, so let's change it back.
Click in the Back Style box and change the property of the LastName text box control back to Normal.
Once the Properties dialog box is open, you can simply click any control to display its properties.
Click the LastName label (NOT the LastName text box).
The Properties dialog box now displays the properties for the LastName label. You can tell which control's properties are being displayed by looking at the Title bar of the Properties dialog box.
Click on the Close button to close the Properties dialog box.
Table 7-3. Tabs in the Properties Dialog Box
Properties that determine the object's appearance, such as color, text formatting, line and border color/thickness, and special effects. The purpose of many Formatting properties should be pretty obviousfor example, Font Size determines the font size of the control.
Properties that determine where a control get its data, its default value (if any), and data validation rules for the control.
Actions to which you can assign a macro or Visual Basic procedure. For example, clicking a button or entering information in a particular field could trigger a macro to run.
Miscellaneous but important properties, such as the name of the control, if tabbing to the control is allowed, and if a message should appear in the Status bar when the control is selected.
Displays all the properties for the control.
TO DISPLAY THE PROPERTIES FOR ANY CONTROL:
DISPLAY THE FORM IN DESIGN VIEW.
SELECT THE CONTROL AND CLICK THE PROPERTIES BUTTON ON THE TOOLBAR.
RIGHT-CLICK THE CONTROL AND SELECT PROPERTIES FROM THE SHORTCUT MENU.
SELECT THE CONTROL AND SELECT VIEW