Microsoft KB Archive/130865

= How to place totals or other information on the last page of the report in the page footer =

Article ID: 130865

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.6 Standard Edition
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.5a
 * Microsoft FoxPro 2.5b for MS-DOS
 * Microsoft FoxPro 2.6 for MS-DOS
 * Microsoft FoxPro 2.6a Standard Edition
 * Microsoft FoxPro 2.5b for Macintosh
 * Microsoft Visual FoxPro 2.5c for Macintosh
 * Microsoft FoxPro 2.6a Professional Edition for Macintosh
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition
 * Microsoft Visual FoxPro 8.0 Professional Edition
 * Microsoft Visual FoxPro 9.0 Professional Edition

-



This article was previously published under Q130865



SUMMARY
When using the Report Writer or the Report Designer in Visual FoxPro, you can use the Summary band to place information at the end of the report on the bottom of the last page where the page footer is located.

By design, the Summary band places information at the end of a report, but the information is positioned right after the last record printed. However, you may want to place the information at the bottom of the page where the page footer is located. This article describes how to accomplish this.



MORE INFORMATION
Do not use the Summary band. Instead, place the expressions that hold the summary information on the page footer with a conditional IIF statement in the expression that checks for the last record of the table. Below are the steps needed to place the summary information in the page footer section.

Before creating or running the report, ensure that the rectotal variable used in the conditional IIF below is already set to the total number of records that need to be printed. To do this, type the following command in the Command window to get the total number of records in a table: rectotal=RECCOUNT If the report is going to use a FOR clause, use the same FOR condition in the COUNT command to store the number of records to be printed in the rectotal variable. For example, use this command: COUNT FOR fieldname="whatever" TO rectotal

Method 1 for FoxPro for Windows versions 2.x
 Open the report. Make a field expression by choosing the AB tool that enables you to make a report expression.  In the report expression box, type: IIF(rectotal=counter, "Yes we are at the end!","")  Select Variables from the Report menu.  In the variable text box, type this variable name: counter   In the Value to Store text box, type this number: 1                            Select the Sum option in the Calculate text box.</li> Make sure that the Reset selection is at "End of Report."</li> From the Report menu, select Page Review.</li></ol>

You will see the phrase "Yes we are at the end!" located in the page footer of the last page only. This simulates a Summary band that puts information at the bottom of the last page of a report.

NOTE: If you are using Visual FoxPro and the Print Area is set to "Whole Page" in the Page Setup dialog box, the information in the page footer may not appear. Sliding the Page Footer bar down one or more lines in the Report Designer makes the Page Footer information appear.

Method 2 for Visual FoxPro for Windows
<ol> Open the report.</li> Create a field expression by selecting the AB tool from the Report Controls toolbar that allows you to create a report expression.</li>  In the report expression box, type the following: "Yes, we are at the end of this Visual FoxPro report!" </li> Select the Print When command button.</li>  In the Print Only When Expression Is True text box, type: recno=reccount NOTE: This expression does not work in FoxPro 2.x. </li> From the Report Menu, select Page Review and you now see the phrase "Yes, we are at the end of this Visual FoxPro report!" located in the page footer of the last page only.

NOTE: This simulates a Summary band that puts information at the bottom of the last page of a report.</li></ol>

To print a calculation you may substitute a calculation expression for the text expression.

Additional query words: VFoxWin

Keywords: kbcode KB130865

-

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

© Microsoft Corporation. All rights reserved.