Create a Subform | CustomGuide

Create a Subform

How to Create a Subform in Access

Create a Subform

A subform is a form within a form. Subforms are especially useful when you want to show data from tables or queries with a one—to—many relationship. For example, a Customer form might have a subform that displays each customer's Orders.

The main form and subform are linked so that the subform displays only records that are related to the current record in the main form. For example, when the main form displays a particular customer, the subform displays only orders for that customer.

  1. In Design View, resize the form as necessary.

    Now you're ready to add the subform.

  2. Click the Controls button on the ribbon.
  3. Click the Subform/Subreport button.
    Create a Subform

    The mouse pointer changes to a Create a Subform, indicating that you can click and drag the subform onto the main form.

  4. Click and drag where you want the subform to appear.
    Create a Subform

    The Subform Wizard appears and asks if you want to use an existing form for your subform or create a new one using tables or queries.

  5. Click the Next button.
    Create a Subform

    The next step of the Wizard appears. Here you have to select the table or query and fields that you want to display in your subform.

  6. Click the Tables/Queries list arrow and select a table or query.
    Create a Subform

    It's very important that the underlying tables or queries of the main form and subform have a related field and that the related field appears somewhere on both forms.

    Now you need to select the fields you want to appear in the subform. You must select the related field used to join the main form and subform. This related field must appear on both the main form (where it is called the parent field) and on the subform (where it is called the child field).

  7. Select the fields you want to appear in the subform and click Next.
    Create a Subform

    The next step in the Wizard is to define the fields that link the main form and the subform. The Subform Wizard is often smart enough to recognize the field and use it to link the two forms. If not, you will have to click the Define my own option and select the two related fields.

  8. Specify the parent and child fields that link the main form and subform and click Next.
    Create a Subform
  9. Give your subform a name and click Finish.
    Create a Subform

Access creates the subform and adds it to the main form.

Subforms created with the Subform Wizard are usually a little rough around the edges and may require a little clean-up work.