Link a main report and a subreport
If you create a subreport with the Report Wizard or the Subreport Wizard, Microsoft Access automatically links the main report with the subreport under certain conditions. For more information, click
. If your main report and subreport don't meet these conditions, you can use this procedure to link them.
- Open the main report in Design view.
- To display the property sheet, make sure the subreport control is selected, and then click Properties
on the toolbar.
- Set the linking fields. To enter more than one linking field or control, separate the field or control names with a semicolon. If you enter more than one field or control, you must enter the names in the same order in the LinkChildFields and LinkMasterFields properties.
- In the LinkChildFields property box, enter the name(s) of the linking field(s) in the subreport.
- In the LinkMasterFields property box, enter the name(s) of the linking field(s) or control(s) in the main report.
Note You can't use the name of a control in the LinkChildFields property box.
If you're unsure what the linking field(s) should be, click the Build button
next to either property box to open the Subform/Subreport Field Linker.
Notes
- The linking fields don't have to appear in the main report or the subreport, but they must be included in the underlying record source. If you use the Report Wizard to create the subreport, Microsoft Access automatically includes the linking fields in the underlying record source even if you don't select them in the wizard.
- The linking fields must contain the same kind of data and have the same or a compatible data type or field size. For example, an AutoNumber field is compatible with a Number field whose FieldSize property is set to Long Integer.
- For information on troubleshooting subreports, click
.