PRB: Report Duplicates Parent Records in One-to-Many

Last reviewed: April 29, 1996
Article ID: Q88602
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6a, 2.6a
  • Microsoft FoxPro for Windows, versions 2.5x, 2.6, 2.6a
  • Microsoft FoxPro for Macintosh, versions 2.5x and 2.6a

SYMPTOMS

If a parent-child one-to-many relationship is set between two databases and a report is created that prints only parent records, the parent records will be duplicated in the detail line as many times as there are related child records. For example, if a parent record has three associated child records, the parent record will be repeated three times on the report.

RESOLUTION

Set SKIP to OFF to terminate the one-to-many relationship. If this is not feasible, choose Data Grouping from the Page Layout menu and set up a grouping on the related field. Then move all parent record fields to the group header or footer band.

STATUS

This behavior is by design.

MORE INFORMATION

The following is an example using the CUSTOMER and INVOICES databases in the TUTORIAL subdirectory.

  1. Set up the one-to-many relationship.

  2. Create a report with a data grouping on the CNO field in CUSTOMER. Place the desired fields in the group header and/or group footer band.

  3. In the Detail band, place information from INVOICES. In the Summary band, add JUNK().

  4. Save the report.

  5. In the Command window, issue the following command to create JUNK.PRG:

          MODIFY COMMAND junk
    

  6. Type the following commands in JUNK.PRG:

          SET SKIP TO
          SUM ytdpurch TO test
          RETURN test
    

  7. In the Command window, issue the following command:

          SET PROCEDURE TO junk
    

  8. Issue a SET FILTER command if needed.

  9. In the Command window, issue the following command:

          REPORT FORMAT <filename> PREVIEW
    

The correct total from the parent table should now be displayed.


Additional reference words: FoxDos FoxWin FoxMac 2.00 2.50
2.50a 2.50b
2.50c 2.60a
KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.