ACC: How to Display and Total Subtotals from SubreportsLast reviewed: July 18, 1997Article ID: Q129721 |
The information in this article applies to:
SUMMARYModerate: Requires basic macro, coding, and interoperability skills. This article demonstrates how you can use a total from a subreport on a main report and how you can display a total for all the subreports.
MORE INFORMATIONIf you use an expression similar to
=Sum([MySubReport].Report![Product Sales])on a main report to sum a reference to a subreport control that contains a subtotal, you receive a "#Name?" error message. This error message occurs because the Sum() function (and the other aggregate functions) can reference only fields, not controls. To avoid this error, place the sum expression in the subreport's report footer, and then reference that expression in the main report. CAUTION: Following the steps in the examples below will modify the sample database Northwind.mdb (or the NWIND.MDB in version 2.0). You may want to back up the Northwind.mdb or NWIND.MDB file or perform these steps on a copy of these databases.
Displaying the Total from a Subreport on a Main ReportTo display the total from a subreport on a main report, follow these steps.
Displaying a Total for All SubreportsTo display a grand total for all subreports, you can use either a second subreport or a control's RunningSum property. Using a Second Subreport: You can use a second subreport to display a grand total. When you add a second subreport to a group footer section, make sure to link the subreport to the grouped field so that the subreport displays the total for that group. If you place the subreport in the report footer section, do not link the subreport to the grouped field so that the subreport displays a total for all the records. The following example demonstrates how to use a second subreport to display a grand total on a main report:
To use the RunningSum property to display a grand total on a main report, follow these steps:
REFERENCESFor more information about creating totals in reports, search the Help Index for "totals," or ask the Microsoft Access 97 Office Assistant. For more information about the RunningSum property in Microsoft Access 2.0, search for "RunningSum," and then "RunningSum Property" using the Microsoft Access Help menu. Or see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q115877 TITLE : ACC2: RunningSum Text Box in Report Not Accumulating ValuesFor more information about summing calculations, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q129096 TITLE : ACC: How to Sum a Calculation in a Report |
Additional query words: running
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |