Giving Your Forms a Consistent Look

3 4

Experimenting with various form colors and fonts and trying all the AutoFormat styles is fun, but once you decide which background color, text font, and background style you prefer, it’s best to apply that style consistently to all the forms in the database. You don’t have to apply the formatting selections manually to each form—you can save your custom style as one of the AutoFormat choices so that you can quickly apply it to other forms.

A consistent color/font scheme gives an application a professional appearance, much like a Web page that uses a Microsoft FrontPage theme. You can use background color (both for forms themselves and for controls on forms) to give the user visual cues about how the form works. For example, you can use one background color for editable forms (or controls) and another color for read-only forms or controls.

Using Form Templates

Whenever you create a new form in Design view without using the Form wizard, the form is based on a form template. Unlike Word templates, which allow you to set up every aspect of a template’s appearance—and even much of its functionality, by using macros (Visual Basic for Applications [VBA] Sub procedures)—Access templates specify only a few basic form features, such as the background color of form sections and certaincontrol properties. Although Access templates can include VBA code, when you create a new form from the template, the form doesn’t inherit any of the code from the template’s code module.

Although you can’t preload an Access form template with a set of standard controls or include boilerplate code, you can specify the fonts, sizes, or other properties for controls on the new form. You have to import the form or report template into any database in which you want to use it. Because of these limitations, and because the AutoFormat feature now lets you apply one of a set of styles to a form, few Access users take the trouble to create a form template.

However, form templates do offer some advantages over customized AutoFormats. For example, you can specify different colors for the form header, footer, and detail sections. You can also specify properties for various types of controls by placing controls on the template form, setting them as desired, and then choosing Format, Set Control Defaults with the controls selected, as shown in Figure 5-35.

figure 5-35. you can set control defaults for a form template.

Figure 5-35. You can set control defaults for a form template.

If you do create an Access template and you want to use it when creating a new form in Design view, you must enter the template’s name on the Forms/Reports tab of the Options dialog box, as shown in Figure 5-36.

figure 5-36. enter your form template’s name on the forms/reports tab of the options dialog box.

Figure 5-36. Enter your form template’s name on the Forms/Reports tab of the Options dialog box.

Now, when you create a new form in Design view, it will have the same header, footer, and detail background colors as the template, and the controls you place on the form will have the default values you set in the template—but only if the template form is available in the current database.

caution


The template name that you enter appears on the Forms/Reports tab of the Options dialog box in all databases, but if the named template isn’t included in the current database, a new form will use the default Normal template instead.

Using AutoFormat

AutoFormat allows you to apply to your forms the preset format choices already created in Access. You can use AutoFormat styles as they are or you can modify and save them to use again on other projects. The AutoFormat feature is simpler to use than a form template, and it doesn’t require you to change any settings in the Options dialog box. Any custom styles you create are available in all your databases, without the need toimport any objects into new databases. However, AutoFormat styles don’t let you specify different colors for different form sections.

To create and save a custom AutoFormat style, follow these steps:

  1. Create a new form in Design view, and set the form’s properties as you prefer. For example, choose custom colors for the form’s header, footer, and detail sections.
  2. If you want to set default control properties, place a control on the form, set its properties as desired, and then highlight it and choose Format, Set Control Defaults.
  3. Repeat step 2 as needed for a sample control of each type of control you anticipate using regularly. (Set at least the formats for text boxes, labels, combo boxes, and list boxes.)
  4. When the form and its controls have the settings you want, choose Format, AutoFormat to open the AutoFormat dialog box, and select one of the built-in styles that you don’t use, as shown in Figure 5-37. You’ll overwrite this style with your new, custom version.

    figure 5-37.select a built-in style to overwrite with a custom style.

    Figure 5-37. Select a built-in style to overwrite with a custom style.

  5. Click Customize to open the Customize AutoFormat dialog box, shown in Figure 5-38.

    figure 5-38.overwrite the built-in style with your custom style.

    Figure 5-38. Overwrite the built-in style with your custom style.

  6. The default selection is to overwrite the selected built-in style with the values from the open form. Click OK to save your format settings to the selected style.

Now, when you apply your custom style to a form, that form will have the colors and control formatting settings you saved to that style. Figure 5-39 shows an example of an applied custom style.

figure 5-39. the style saved from form1 as the industrial autoformat style has been applied to the test form.

Figure 5-39. The style saved from Form1 as the Industrial AutoFormat style has been applied to the Test form.

Using the Design Schemes Add-In

I originally created the Design Schemes add-in for Access 95, which had no AutoFormat utility. The form template feature in that version was the only option for applying a custom style to newly created forms and did not meet the needs of manyadvanced users. AutoFormat now offers you control over form section colors and control formats, but you must save your settings to the named style in the AutoFormat dialog box, and you still can’t populate new forms with controls or boilerplate event procedures.

Additionally, saved AutoFormats don’t allow you to create different types of forms useful for different situations, such as dialog forms, subforms, or forms with a record selector combo box in the header and a Close Form command button in the footer. The Design Schemes add-in allows users to select one of a set of predesigned forms with different sets of form properties. Users can also apply one of four standard (conservative) color schemes to the new form or create a custom color scheme (using the Design Schemes add-in’s full selection of control properties).

The Design Schemes add-in is described in detail in Chapter 15, "Using Add-Ins to Expand Access Functionality."



Microsoft Access Version 2002 Inside Out
Microsoft Access Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612838
EAN: 2147483647
Year: 2005
Pages: 172
Authors: Helen Feddema

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net