Microsoft KB Archive/140489

= One-to-many report prints first child if the scope is one =

Article ID: 140489

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * 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 Q140489



SYMPTOMS
A one-to-many report with a scope of one record in the parent table does not display all the related records in the child table. Only the first related child record prints where the tables have a parent and child one-to-many relationship.



CAUSE
In one-to-many relationships, when you skip through the parent table, the record pointer remains on the same parent record until the record pointer moves through all related records in the child table.



RESOLUTION
To have all the related records in the child table print for a specific parent record:


 * Use the FOR  clause of the REPORT FORM command to identify the record in the parent table. -or-


 * Use the NEXT  clause of the REPORT FORM command where  = the number of child records related to the parent record.



STATUS
This behavior is by design.



MORE INFORMATION
For more information about how to specify a scope for a report in Visual FoxPro, please see the following article in the Microsoft Knowledge Base:

135342 BUG: Scope on Report Command Doesn't Work as It Did in 2.x

Visual FoxPro Steps to Reproduce Behavior
 Open the Testdata database located in the \Samples\Data directory under the Main Visual FoxPro directory. Create a new report using the One-to-Many Report Wizard.

 Fields from the parent table

Select Customer for the parent table, and choose any fields. Fields from the child table

Select Orders for the child table, and choose any fields.</li> Relationships

Customer.cust_id -- Orders.cust_id (should be the default)</li> Sort order

Ignore. Go on to Step 5.</li> Style

Use the defaults. Go on to Step 6.</li> Finish

Choose "Save report for later use" and click Finish.</li></ol> </li> Save the report as Test.frx in the default directory.</li> In the Command window, type:

REPORT FORM test RECORD 3

-or-

REPORT FORM test NEXT 1

</li> Examine the report. Only the first of thirteen child records prints.</li></ol>

Example Resolution
To resolve this behavior, use the FOR clause of the REPORT FORM command, as in these examples: REPORT FORM Test FOR Cust_Id = "ANTON" -or- REPORT FORM Test FOR RECNO = 3 -or- REPORT FORM Test NEXT x where x is the number of child records related to the parent record.

Additional query words: 2.50 2.50a 2.50b 2.60 2.60a FoxWin VFoxWin

Keywords: KB140489

-

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

© Microsoft Corporation. All rights reserved.