Office 2007 - Access

Lesson 42: Subforms

42/72 Lessons 

Add “Subform”

Let me first explain what a “Subform” is.
A “Subform” is a form that is added to another form, the main form.
A “Subform” shows data related to the data in the main form.
For example, we have the “customers” form and to this form we wish to add a “Subform” that shows us the orders for each customer.
We have several ways of adding a “Subform”.

A first way is by making use of the wizard.
First, open the form in which you want to add a “Subform” in “Design View”.
Select the Wizard button in the”Ribbon” under the “Design” contextual tab and click the “Subform” button.
Click and drag it into the form at the place where you want to insert the “Subform”.

This opens the first window of the wizard.

In this window, we determine where the data in the “Subform” is to be retrieved from a table / query or a form.

Because I already have an “Orders” form that I had made, I choose the second option, select the form and click the “Next” button.

In the second window you determine which fields from the form and “Subform” are linked to each other.

If you choose the first option which is “Select from a list”, then “Access” will determine which fields are eligible.

As an example I choose the “Define My own” option.

This opens fill boxes where you have to determine the linked fields for the form and the “Subform” .

These subjects would not of course be shown if you had chosen the “Select from a list” option.

I choose the “CustomerID” for both the form and the “Subform”.

And click “Next”.

This takes you to the last window of the wizard where you enter a name for the “Subform”.
Click the “Finish” button.
See the result in “Form View”:


Clicking on the navigation buttons of the main form shows you the different customers.
Clicking on the navigation buttons of the “Subform”, gives you all the orders of the selected customer in the main form.

A second way, which I think the quickest, is to click the form that you want to use as a “Subform”, from the “Navigation panel”, and  drag it into the main form.

Awesome!
You've completed Lesson 42
START NEXT LESSON