Microsoft KB Archive/137413

= BUG: Report Designer creates child records in one-to-many report in Visual FoxPro =

Article ID: 137413

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 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 Q137413



SYMPTOMS
When you create a one-to-many report by using the Visual FoxPro Report Designer, blank child records are created for parent records without matching children. Numeric fields are represented by zeroes, character fields are represented by spaces, date fields are represented by a blank date separated by slashes, and logical fields are represented by a false (.F.) value. This behavior occurs if data from the child table is placed in the Detail band of the report.



WORKAROUND
For each data type, the workaround is slightly different. The Report Expression for each field in the Detail band linked to the child table must be modified.

For Character fields
In the Print When clause, click Remove Line If Blank.

For Any Numeric Data type
In the Format dialog box, click Blank if Zero. Then in the Print When dialog box, click Remove Line If Blank.

For Date or DateTime Fields
In the Print When dialog box, click Remove Line if Blank. Type the following in the "Print Only When Expression is True" box: !EMPTY(child.date_field) Here date_field is the name of your date field.

For Logical Fields
In the Print When dialog box, click Remove Line if Blank. Type the following in the "Print Only When Expression is True" box: !EMPTY(child.key_Field) In this expression, use the child table's key field that links it to the parent table to see if it is empty. If the child table's key field is empty, you know there is no child record. The Report Writer automatically assigns logical fields a value of false (.F.), therefore the Remove Line if Blank option will not work on its own.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Problem
 Open the Testdata.dbc database located in the Samples\Data subdirectory under the main Visual FoxPro directory. Create a Report using the one-to-many Report Wizard. In Step 1 of the Wizard, select Orders as the parent table, and select the Order_id field as an output field. In Step 2, select Orditems as the child table, and select the Line_no, Product_id, and Quantity fields for output. In Step 3, establish the relationship between the Order_id fields of the parent and child tables. In Step 4, set the sort order to Order_id. Then click Finish, and save the report for later use.</li> Browse the Orditems.dbf table, mark the record with an Order_id of 10000 for deletion.</li> In the Command window, type:

SET DELETED ON

</li> Open the report in the Report Designer, and preview the report. A blank child record is created for Order_id 10000.</li></ol>

Additional query words: kbvfp300 kbvfp500 kbvfp600

Keywords: kbbug KB137413

-

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

© Microsoft Corporation. All rights reserved.