Available control properties vary quite a
bit, depending on the type of control. The following sections cover the
most common properties. To view the properties of a control, select the
control, and then open the Properties window.
The Format Properties of a Control
The Format properties of a control affect the
appearance of the control. You use these properties to change the
color, size, font, and other physical attributes of the control.
view the Format properties of a control, with the control already
selected, and the Properties window open, click the Format tab (see Figure 1). The text that follows discusses many of these properties and their uses.
Figure 1. The Format properties of a control.
Format— The Format
property of a control determines how Access displays the data in the
control. A control’s format is automatically inherited from its
underlying data source. Access lets you use this property in three
situations: when the Format property is not set for the underlying field, when you want to override the existing Format
setting for the field, and when you want to apply a format to an
unbound control. You can select from a multitude of predefined values
for a control’s format, or you can create a custom format. I often
modify the Format property at runtime to vary the format of a
control, depending on a certain condition. For example, the format for
a Visa card number is different from the format for an ATM card number.
Decimal Places— The Decimal Places property specifies how many decimal places you want to appear in the control. This property is used with the Format property to determine the control’s appearance.
Caption— You use the Caption property to specify information that is helpful to the user. It’s available for labels, command buttons, and toggle buttons.
Visible— The Visible
property indicates whether a control is visible. This property can be
toggled at runtime, depending on specific circumstances. For example, a
question on the form might apply only to records in which the gender is
set to Female; if the gender is set to Male, the question isn’t visible.
Display When— The Display When
property is used when you want certain controls on a form to be sent
only to the screen or only to the printer. The three settings for this
property are Always, Print Only, and Screen Only. An example of the use
of the Display When property is for a label containing instructions. You can use the Display When property to have the instructions appear onscreen but not on the printout.
Scroll Bars— The Scroll Bars
property determines whether scrollbars appear when the data in a
control doesn’t fit within the control’s size. The options are None and
Vertical. I often set the Scroll Bars property to Vertical
when the control is used to display data from a memo field. The
scrollbar makes it easier for the user to work with a potentially large
volume of data in the memo field.
Back Style and Back Color— You can set the Back Style
property to Normal or Transparent. When this property is set to
Transparent, the form’s background color shows through the control.
This is often the preferred setting for an option group. The control’s Back Color property specifies the background color (as opposed to text color) for the control.
If the Back Style property of a control is set to Transparent, the control’s Back Color property is ignored.
Special Effect— The Special Effect
property adds 3D effects to a control. The settings for this property
are Flat, Raised, Sunken, Etched, Shadowed, and Chiseled. Each of these
effects gives a control a different look.
Border Style, Border Color, and Border Width— The Border Style, Border Color, and Border Width properties affect the look, color, and thickness of a control’s border. The settings for the Border Style property are Transparent, Solid, Dashes, Short Dashes, Dots, Sparse Dots, Dash Dot, and Dash Dot Dot. The Border Color property specifies the color of the border; you can select from a variety of colors. The Border Width property can be set to one of several point sizes.
If the Border Style property of a control is set to Transparent, Access ignores the control’s Border Color and Border Width properties.
Fore Color, Font Name, Font Size, Font Weight, Font Italic, and Font Underline— The Fore Color, Font Name, Font Size, Font Weight, Font Italic, and Font Underline
properties control the appearance of the text in a control. As their
names imply, they let you select a color, font, size, and thickness of
the text and determine whether the text is italicized or underlined.
You can modify these properties in response to a runtime event. For
example, you can modify a control’s text color if the value in that
control exceeds a certain amount. The Font Weight property
settings generally exceed what is actually available for a particular
font and printer—normally, you have a choice of only Regular and Bold
in whatever value you select for this property.
Text Align— The Text Align property is often confused with the ability to align controls, but the Text Align property affects how the data is aligned within a control.
Left Margin, Top Margin, Right Margin, and Bottom Margin— The Left Margin, Top Margin, Right Margin, and Bottom Margin
properties determine how far the text appears from the left, top,
right, and bottom of the control. They are particularly useful with
controls such as text boxes based on memo fields, which are generally
Line Spacing— The Line Spacing
property is used to determine the spacing between lines of text in a
multiline control. This property is most commonly used with text boxes
based on memo fields.
Notice Figure 2. This TextBox control uses many of the Format properties that we just learned about. I set the Scroll Bars property to Vertical so that the control appears with a vertical scroll bar. I modified the Back Color property. I then set the Border Style to Solid, modified its color, and made it very
wide. I modified and enlarged the font, made it extra bold and italic.
Finally, I aligned the text so that it is centered within the control.
Notice that you can see all of these changes graphically, as well as
the properties that affect the control.
Figure 2. A TextBox control using many of the Format properties.