Working with Sections and Subforms

To round out this chapter, we'll take a brief look at two more form design topics: sections and subforms. Access forms can have multiple sections and can display subforms.

Form Sections

Form sections provide a way to logically group some of the controls on forms. The list of available sections is fixed by Access. In practice, the following are the three sections you're likely to use:

  • Form header This section appears at the top of the form, above all the records.

  • Form detail This section is where the actual records appear. The detail section might be displayed many times, if you have the form set to continuous view.

  • Form footer This section appears at the bottom of the form, below all the records.

To see form sections in action, you can work with the Catalogs form by doing the following:

  1. Open the Catalogs form in design view.

  2. In design view, you'll see several gray bars running the width of the form. You might have ignored these, but now you can see that they mark the sections of the form. Place your cursor at the bottom of the Form Footer bar and drag it downward to create an actual footer section.

  3. Click the Command Button control in the Toolbox.

  4. Click in an empty area in the footer section of the form to launch the Command Button Wizard.

  5. Select Record Navigation in the Categories list. Then select Go To Last Record in the Actions list and click Next .

  6. On the second panel of the wizard, accept the default picture and click Next .

  7. On the final panel of the wizard, accept the default name and click Finish .

  8. Save the form and switch back to form view.



To change the background color of a form that doesn't have a picture for a background, select the detail section of the form and edit its Back Color property.

Figure 13.16 shows the modified form. You can see that the controls in the form header (the labels for Name, Address, and so on) appear only once at the top of the form. The controls in the detail section appear multiple times, and the command button control in the form footer appears only once at the bottom of the form.

Figure 13.16. Form sections in action.



You first saw a subform in Chapter 8, "Creating and Using Data Entry Forms." To close this chapter, we'll take a brief look at using subforms in design view. As you'll recall, a subform lets you show a group of related records on a parent form. For example, on the CatalogsMain form, the main part of the form (the parent form) displays information on types, whereas the subform displays a list of plants of the currently displayed type.

To see the details of how forms and subforms work together, follow these steps:

  1. Open the CatalogsMain form in design view.

  2. Click the subform area in design view. You can tell the subform because it has its own set of rulers and its own header and detail section.

  3. Inspect the Properties window for the subform. The Link Child Fields and Link Master Fields properties specify how the form and subform are related. At any time, the subform displays records whose Link Child Fields have the same value as the current Link Master Fields values on the main form.

  4. Although you can edit the subform directly in the main form, this can get confusing. Click outside of the subform to deselect it. Then right-click the subform and select Subform in New Window to edit the subform in a new window, as shown in Figure 13.17.

    Figure 13.17. Working with a subform in design view.


  5. Select the form header in the subform by clicking the gray bar above the header.

  6. Change the Back Color property of the subform header by clicking in the property and using the build button to select a new color.

  7. Click the Save button to save the changes to the subform.

  8. Close the subform.

  9. Switch the main form back to design view; the subform now has the colored header you selected.

Absolute Beginner's Guide to MicrosoftR Access 2002
Absolute Beginner's Guide to MicrosoftR Access 2002
Year: 2002
Pages: 133 © 2008-2017.
If you may any questions please contact us: