Database Reference
In-Depth Information
Adding subreports
When you want to be able to show data from two related tables in a report, you can insert
a subreport into a main report. You create the main report as you would any other report.
Then you use a wizard to insert either the subreport itself or a subreport control into the
main report. In either case, both the main report and the subreport appear as objects in
the Reports group of the Navigation pane.
TIP After establishing the correct table relationships, you can quickly insert an existing
report as a subreport of another by opening the main report in Design view and then
dragging the second report from the Reports group of the Navigation pane to the appro-
priate section of the main report.
Depending on the nature of the information in a report or subreport, you might be able to
enhance the usefulness of both types of reports by performing calculations in them. You
can insert unbound controls and then use the Expression Builder to create expressions that
tell Access what to calculate and how, thereby making summary information and statistics
readily available in one report.
In this exercise, you'll select a query as a record source for a report and insert a subreport
into a main report to display sales per product and per category. Then you'll display calcu-
lated totals for each category.
SET UP You need the GardenCompany09 database you worked with in the preceding
exercise to complete this exercise. If necessary, open the database. Then open the Sales
By Category report in Design view, and follow the steps.
1
Double-click the report selector to select the report and open the Property
Sheet pane.
2
On the Data page, click the Record Source arrow, and in the list, click Sales By
Category to base the report on the results of that existing query. Then close the
Property Sheet pane.
3
On the Design tool tab, display the menu containing the Controls gallery, and ensure
that Use Control Wizards is active. Next click the Subform/Subreport button. Then
click in the CategoryName Header section approximately two grid points below the
lower-left corner of the Product label control to insert a blank, unbound subreport
control into the main report and start the SubReport wizard.
Search WWH ::




Custom Search