PRB: Relationship Behaves Differently in Diff. Browse Windows

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

SYMPTOMS

The relationship between two tables (for example, tables named Parent and Child) appears to be correct when you are browsing the two tables simultaneously, but in a single Browse window that contains fields from both tables, the relationship is revealed to be incorrect.

RESOLUTION

For the relationship to work correctly in all cases, you must create an index in Child that is the same length as the related field in Parent. For example:

   SELECT 2
   INDEX ON PADR(num,4) TAG OKNUM
   SET ORDER TO OKNUM
   SELECT 1
   SET RELA TO parent.num INTO child

MORE INFORMATION

Steps to Reproduce Problem

  1. Create two tables: "Parent", which has a character field named "Num" with a width of 4, and "Child", which has a character field named "Num" with a width of 2.

  2. In Parent, add two records "0 " (zero followed by three spaces)
       and "1   " ("1" followed by three spaces).
    
    

  3. In Child, add two records "0 " (zero followed by one space) and "1 " ("1" followed by one space).

  4. In the Command window, type the following commands:

          CLOSE DATABASES
          USE parent IN 1
          USE child IN 2
          SELECT 1
          INDEX ON num TAG num
          SELECT 2
          INDEX ON num TAG num
          SELECT 1
          SET RELATION TO parent.num INTO child
    

  5. Open two Browse windows, one for Parent and one for Child. Note that when the record pointer in Parent is on either of the two records in Parent, only the related record appears in the Browse window for Child.

  6. Close the two Browse windows, and type the following commands in the Command window:

          SELECT 1
          BROWSE FIELDS parent.num, child.num
    

Note that only the value for the Parent field appears. This behavior will also occur if a report is built using the relationship between Parent and Child.


Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a
KBCategory: kbprg kbprb
KBSubcategory: FxprgBrowse


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.