Microsoft KB Archive/326453

= ACC97: Incorrect Totals Occur When You Print or Preview a Report =

Article ID: 326453

Article Last Modified on 2/1/2007

-

APPLIES TO


 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q326453



Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
When you perform calculations in a report, the calculations may be incorrect when you print from the Print Preview view or when you preview the report.



CAUSE
You are programmatically calculating your totals. The totals are calculated by using a report event that fires per page. Each page must be previewed to fire that event for that page and then calculate the correct totals.



RESOLUTION
You can use one of the following methods to work around this issue:

Method 1
Print the Report Without Previewing:

Print the report without first previewing the report.

Method 2
Save the Report As a Snapshot:
 * 1) Open the report in Print Preview.
 * 2) On the File menu, click Save As/Export.
 * 3) In the Save As dialog box, click to select To an external file or database and then click OK.
 * 4) In the Save as type drop-down list, click to select Snapshot Format, specify the name and location for your snapshot file, and then click Export.

For additional information about report snapshots and Microsoft Snapshot Viewer, click the article number below to view the article in the Microsoft Knowledge Base:

172348 ACC97: Report Snapshots and Microsoft Snapshot Viewer

Method 3
Scroll Through All Pages of the Report:


 * 1) Open the report in Print Preview.
 * 2) Use the navigation buttons to scroll through all pages of your report.

Method 4
Put Calculations in an Underlying Query:

If possible, put calculations in an underlying query instead of on the report.

Method 5
View Multiple Pages at a Time:
 * 1) Open the report in Print Preview.
 * 2) On the View menu, point to Pages and then select the number of pages that you want to view.



MORE INFORMATION
This behavior has been changed in Microsoft Access 2002.

Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb. Close the Startup screen and the Switchboard form if they appear. Click Reports under Objects and then click New. In the New Table dialog box, click to select AutoReport: Columnar, select the Employees table from the Choose the table or query where the object's data comes from drop-down list, and then click OK to preview the report. Close the report and then save it as EmployeesTest .</li> Open the EmployeesTest report in Design view.</li> Add a Text Box to the &quot;Report Footer&quot; section and name it GrandTotal .</li> On the View menu, click Code.</li>  Type or paste the following code in the &quot;General Declarations&quot; section: Public Total as Integer </li>  Type or paste the following code on the OnPrint event of the &quot;Detail&quot; section: 'Count the number of records where the country is USA If Me!Country = &quot;USA&quot; Then Total = Total + 1 End If                   </li>  Type or paste the following code on the OnPrint event of the &quot;Report Footer&quot; section: 'Put the total in the GrandTotal field Me!GrandTotal = Total </li> On the File menu, click Close to close the code module.</li> On the View menu, click Print Preview.</li> Click the navigation button at the bottom of the report to go directly to the last page without scrolling through any other pages on the report.</li> Note that the value in the GrandTotal field is incorrect.</li></ol>

Additional query words: prb

Keywords: kbprb KB326453

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.