MS Access

Working with Control Properties

Here the Properties dialog box

Every control on a form every 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 figure.

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.

  1. Open the frmCustomers form in Design view.

    Here's one way to view the properties for a control:

  2. Select the LastName text box control and display its properties by clicking the Properties button on the Form Design toolbar.

    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 » Properties from the menu.

    The Properties dialog box appears and displays the properties for the LastName text box control, as shown in figure. 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:

    • Click to display a list of options to change the settings for the selected property.

    • Click to invoke a Wizard or display a dialog box that you can use to change the settings for the selected property.

    Move on to the next step and we'll try changing one of the LastName text box control's properties.

  3. Click the Format tab, if necessary, then find and click in the Back Style box and select Transparent from the menu.

    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.

  4. 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.

  5. 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.

  6. Click on the Close button to close the Properties dialog box.

Tabs in the Properties Dialog Box
Tab Description

Format

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 obvious for example, Font Size determines the font size of the control.

Data

Properties that determine where a control get its data, its default value (if any), and data validation rules for the control.

Event

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.

Other

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.

All

Displays all the properties for the control.


TO DISPLAY THE PROPERTIES FOR ANY CONTROL:

  1. DISPLAY THE FORM IN DESIGN VIEW.

  2. SELECT THE CONTROL AND CLICK THE PROPERTIES BUTTON ON THE TOOLBAR.

    OR...

    RIGHT-CLICK THE CONTROL AND SELECT PROPERTIES FROM THE SHORTCUT MENU.

    OR...

    SELECT THE CONTROL AND SELECT VIEW » PROPERTIES FROM THE MENU.