Microsoft KB Archive/276501

= How to set a &quot;page # of #&quot; counter in a report in Visual FoxPro =

Article ID: 276501

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * 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 Q276501



SUMMARY
PageOf.exe contains a sample Visual FoxPro report that sets a &quot;page # of #&quot; counter. To generate the counter, the report dynamically calculates how many lines are used on the detail line to accommodate the fields. The records on the table are divided by the amount of detail lines and then used to generate the counter.

Note This method works in Visual FoxPro 9.0 Professional Edition. However, you can also use Visual Fox Pro 9.0 Report Listener to do the same task.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

PageOf.exe

Release Date: Nov. 1, 2000

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. The PageOf.exe file contains the following files:

To use the sample, perform the following steps:  Download and save files. Start Visual FoxPro.  From the Command window type: REPORT FORM PAGEOF PREVIEW  Note the &quot;Page 1 of 11&quot; page footer. To see how the sample works, drag the detail down to expand the detail area; this causes fewer records per page and thereby increases the number of pages. You can also expand the header and footer sections of the report, and it automatically performs the calculations.

The core of the calculations are contained in two report variables called nLineCount and nLineCalc. The report also uses the Init event of the cursor in the Data Environment to save how many records are in the table. You need to adjust the code according to whether or not your table is going to hold deleted records. Here are two code samples that illustrate these two scenarios: *!* Init Event Code to exclude deleted records. Public nRecNo SET DELETED ON COUNT ALL FOR !DELETED TO nRecNo -or-

*!* Init Event Code for all records. nRecNo = RECCOUNT This sample has limited functionality, and does not function correctly with data grouping or memo fields that stretch with overflow. Data grouping and memo fields that stretch with overflow cause an inconsistent detail line length, thereby affecting the calculations.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

Additional query words: PageOf total pages _pageno footer

Keywords: kbdownload kbfile kbhowto kbreportwriter KB276501

-

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

© Microsoft Corporation. All rights reserved.