Create a subform

If the subform (subform: A form contained within another form or a report.) will be linked to the main form (main form: A form that contains one or more subforms.), make sure the underlying record sources (record source: The underlying source of data for a form, report, or data access page. In an Access database, it could be a table, query, or SQL statement. In an Access project, it could be a table, view, SQL statement, or stored procedure.) are related before using this procedure.

You cannot add a subform to a form when it is displayed in PivotTable or PivotChart view.

ShowCreate a form and subform at the same time

  1. In the Database window (Database window: In Access 2003 and earlier, the window that appears when a database or project is opened. It displays shortcuts for creating new database objects and opening existing objects. In later versions, it is replaced by the Navigation Pane.), click Forms Button image under Objects.
  2. Click the New button on the Database window toolbar.
  3. In the New Form dialog box, double-click Form Wizard.

ShowIf the wizard doesn't start

This could be due to the fact that Access is running in sandbox mode but Microsoft Jet 4.0 SP8 or later is not installed on your computer. Jet 4.0 SP8 or later is required for Access to be fully functional when sandbox mode is enabled.

For more information about installing the Jet upgrade, see the Office Online article About Microsoft Jet 4.0 SP8 or later.

For more information about sandbox mode, see the Office Online article About Microsoft Jet Expression Service sandbox mode.

  1. In the first wizard dialog box, select a table or query (query: A question about the data stored in your tables, or a request to perform an action on the data. A query can bring together data from multiple tables to serve as the source of data for a form or report.) from the list. For example, to create a Categories form that displays products for each category in a subform, select the Categories table (the "one" side of the one-to-many relationship (one-to-many relationship: An association between two tables in which the primary key value of each record in the primary table corresponds to the value in the matching field or fields of many records in the related table.)).

 Note   It doesn't matter which table or query you choose first.

  1. Double-click the fields you want to include from this table or query.
  2. In the same wizard dialog box, select another table or query from the list. Using the same example, select the Products table (the "many" side of the one-to-many relationship).
  3. Double-click the fields you want to include from this table or query.
  4. When you click Next, if you set up the relationships (relationship: An association that is established between common fields (columns) in two tables. A relationship can be one-to-one, one-to-many, or many-to-many.) correctly before starting the wizard, the wizard asks which table or query you want to view by. Using the same example, to create the Categories form, click By Categories.
  5. In the same wizard dialog box, select the Form With subform(s) option.
  6. Follow the directions in the remaining wizard dialog boxes. When you click Finish, Microsoft Access creates two forms, one for the main form (main form: A form that contains one or more subforms.) and subform control (subform/subreport control: A control that displays a subform in a form or a subform or a subreport in a report.), and one for the subform.

ShowCreate a subform and add it to another form

  1. Open the form that you want to add the subform to in Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.).
  2. Make sure the Control Wizards tool Button image in the toolbox (toolbox: A set of tools that is available in Design view for adding controls to a form or report.) is pressed in.
  3. Click the Subform/Subreport tool Button image in the toolbox.
  4. On the form, click where you want to place the subform.
  5. Follow the directions in the wizard dialog boxes.

ShowIf the wizard doesn't start

This could be due to the fact that Access is running in sandbox mode but Microsoft Jet 4.0 SP8 or later is not installed on your computer. Jet 4.0 SP8 or later is required for Access to be fully functional when sandbox mode is enabled.

For more information about installing the Jet upgrade, see the Office Online article About Microsoft Jet 4.0 SP8 or later.

For more information about sandbox mode, see the Office Online article About Microsoft Jet Expression Service sandbox mode.

  1. When you click Finish, Microsoft Access adds a subform control (subform/subreport control: A control that displays a subform in a form or a subform or a subreport in a report.) to your form. It also creates a separate form for the subform.

ShowAdd a form to another form to create a form with a subform

ShowCreate a form with two subforms

The main form has a one-to-many relationship (one-to-many relationship: An association between two tables in which the primary key value of each record in the primary table corresponds to the value in the matching field or fields of many records in the related table.) with the first subform, and the first subform has a one-to-many relationship with the second subform, and the main form contains both the subform controls (subform/subreport control: A control that displays a subform in a form or a subform or a subreport in a report.).

  1. In the Database window (Database window: In Access 2003 and earlier, the window that appears when a database or project is opened. It displays shortcuts for creating new database objects and opening existing objects. In later versions, it is replaced by the Navigation Pane.), click Forms Button image under Objects.
  2. Click the New button on the Database window toolbar.
  3. In the New Form dialog box, double-click Form Wizard in the list.

ShowIf the wizard doesn't start

This could be due to the fact that Access is running in sandbox mode but Microsoft Jet 4.0 SP8 or later is not installed on your computer. Jet 4.0 SP8 or later is required for Access to be fully functional when sandbox mode is enabled.

For more information about installing the Jet upgrade, see the Office Online article About Microsoft Jet 4.0 SP8 or later.

For more information about sandbox mode, see the Office Online article About Microsoft Jet Expression Service sandbox mode.

  1. In the first wizard dialog box, select the table or query (query: A question about the data stored in your tables, or a request to perform an action on the data. A query can bring together data from multiple tables to serve as the source of data for a form or report.) for the main form. For example, suppose you want to create a Customers form that has two subforms — an Orders subform and an Order Details subform. Select the Customers table (the "one" side of the first one-to-many relationship).

 Note   It doesn't matter which table or query you choose first.

  1. Double-click the fields you want to include from this table or query.
  2. In the same wizard dialog box, select the table or query for the first subform. Using the same example, select the Orders table (the "many" side of the first one-to-many relationship), and then double-click the fields you want to include from this table or query.
  3. In the same wizard dialog box, select the table or query for the second subform. Using the same example, select the Order Details table (the "many" side of the second one-to-many relationship), and then double-click the fields you want to include from this table or query.
  4. When you click Next, if you set up the relationships (relationship: An association that is established between common fields (columns) in two tables. A relationship can be one-to-one, one-to-many, or many-to-many.) correctly before starting the wizard, the wizard asks which table or query you want to view by. Using the same example, to create the Customers form, click By Customers.
  5. In the same wizard dialog box, select the Form With subform(s) option.
  6. Follow the directions in the remaining wizard dialog boxes. When you click Finish, Microsoft Access creates a main form with two subform controls. It also creates two other forms, one for each subform.

 Notes 

ShowCreate a form with nested subforms

The main form has a one-to-many relationship (one-to-many relationship: An association between two tables in which the primary key value of each record in the primary table corresponds to the value in the matching field or fields of many records in the related table.) with the first subform, and the first subform has a one-to-many relationship with the second subform, and the second subform is embedded in the first subform.)

  1. Create a form with a subform.

ShowHow?

  1. In the Database window (Database window: In Access 2003 and earlier, the window that appears when a database or project is opened. It displays shortcuts for creating new database objects and opening existing objects. In later versions, it is replaced by the Navigation Pane.), click Forms Button image under Objects.
  2. Click the New button on the Database window toolbar.
  3. In the New Form dialog box, double-click Form Wizard.

ShowIf the wizard doesn't start

This could be due to the fact that Access is running in sandbox mode but Microsoft Jet 4.0 SP8 or later is not installed on your computer. Jet 4.0 SP8 or later is required for Access to be fully functional when sandbox mode is enabled.

For more information about installing the Jet upgrade, see the Office Online article About Microsoft Jet 4.0 SP8 or later.

For more information about sandbox mode, see the Office Online article About Microsoft Jet Expression Service sandbox mode.

  1. In the first wizard dialog box, select a table or query (query: A question about the data stored in your tables, or a request to perform an action on the data. A query can bring together data from multiple tables to serve as the source of data for a form or report.) from the list. For example, to create a Categories form that displays products for each category in a subform, select the Categories table (the "one" side of the one-to-many relationship (one-to-many relationship: An association between two tables in which the primary key value of each record in the primary table corresponds to the value in the matching field or fields of many records in the related table.)).

 Note   It doesn't matter which table or query you choose first.

  1. Double-click the fields you want to include from this table or query.
  2. In the same wizard dialog box, select another table or query from the list. Using the same example, select the Products table (the "many" side of the one-to-many relationship).
  3. Double-click the fields you want to include from this table or query.
  4. When you click Next, if you set up the relationships (relationship: An association that is established between common fields (columns) in two tables. A relationship can be one-to-one, one-to-many, or many-to-many.) correctly before starting the wizard, the wizard asks which table or query you want to view by. Using the same example, to create the Categories form, click By Categories.
  5. In the same wizard dialog box, select the Form With subform(s) option.
  6. Follow the directions in the remaining wizard dialog boxes. When you click Finish, Microsoft Access creates two forms, one for the main form (main form: A form that contains one or more subforms.) and subform control (subform/subreport control: A control that displays a subform in a form or a subform or a subreport in a report.), and one for the subform.

 Note   Select the Tabular (the equivalent of Form view (Form view: A view that displays a form to show or accept data. Form view is the primary means of adding and modifying data in tables. You can also change the design of a form in this view.)) option when the wizard asks what layout you want for the subform.

  1. In Design view (Design view: A view that shows the design of these database objects: tables, queries, forms, reports, and macros. In Design view, you can create new database objects and modify the design of existing objects.) of the main form, select the subform control (subform/subreport control: A control that displays a subform in a form or a subform or a subreport in a report.) and click again inside the control t o select the form, just as you would if you opened the subform in Design view from the Database window (Database window: In Access 2003 and earlier, the window that appears when a database or project is opened. It displays shortcuts for creating new database objects and opening existing objects. In later versions, it is replaced by the Navigation Pane.).
  2. Do one of the following:
  • Repeat step 1 to create the second subform by using the wizard.
  • Drag a form, table, or query from the Database window to the subform. Microsoft Access creates another subform inside the first subform and creates a form for the subform.
 
 
Applies to:
Access 2003