Microsoft KB Archive/114248

= How to print specific number of records in detail band =

Article ID: 114248

Article Last Modified on 2/22/2005

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft FoxPro 2.0
 * 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 Q114248





SUMMARY
By using the Report Writer in FoxPro, you can limit the number of records that print in the Detail band when the report has a data grouping.



FoxPro 2.x Example
The steps below demonstrate how to print only the first ten records from each state in the CUSTOMER database, in a report that is grouped on the STATE field:   In the Command window, issue the following commands: USE \tutorial\customer CREATE REPORT  From the Report menu, choose Quick Report, and then choose OK. From the Report menu, choose Data Grouping. Choose Add, and then set up the data grouping on STATE. From the Report menu, choose Variables. Choose Add, and then create a variable named Count. Assign it an initial value of 0 and a value to store of 1. Under Calculate, select Count, and set Reset to State.</li> For each field in the Detail band, set up the expression as follows:

IIF(COUNT<=10, ,"")

</li> If you are using FoxPro for Windows or FoxPro for Macintosh, choose the Print When check box from within the Report Expression dialog box, and select Remove Line If Blank.

If you are using FoxPro for MS-DOS, choose Page Layout from the Report menu, choose Options, and then select the Suppress Blank Lines check box.</li> Add or move the STATE field to the body of the state data grouping header.</li> From the Report menu, choose Print Preview to see your example.</li></ol>

Visual FoxPro Example
<ol> Open the Orders table.</li> From the Window menu, choose View Window. In VFP 6.0 and later versions, choose the Data Session window.</li> Select the Orders table and click Properties.</li> From the Index Order list box, choose CUST_ID, then choose OK.</li> In the Command window, type:

CREATE REPORT

</li> From the Report menu, choose Quick Report, and then choose OK.</li> Create a data grouping on the Cust_id field.</li> Create a report variable named Count. Assign it an initial value of 0 and a value to store of 1. Under Calculate, select Count, and set Reset to CUST_ID.</li> For each field in the Detail band, set up the expression as follows:

IIF(COUNT<=10, ,"")

</li> If you are using FoxPro for Windows, FoxPro for Macintosh or Visual FoxPro 3.0 or later, choose the Print When check box from within the Report Expression dialog box or the Print When tab from the Field Properties dialog box in Visual FoxPro 9.0, and then select Remove Line If Blank.</li> Add or move the CUST_ID field to the body of the group header.</li> <li>From the Report menu, choose Print Preview to see your example.</li></ol>

Additional query words: VFoxWin FoxMac FoxDos FoxWin 2.50 2.50a 2.50b 2.50c 2.60 set exact precise RWriter

Keywords: KB114248

-

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

© Microsoft Corporation. All rights reserved.