Microsoft KB Archive/101588

{| = PRB: Relationship Behaves Differently in Diff. Browse Windows =
 * width="100%"|

ID: Q101588

2.50 2.50a | 2.00 2.50 2.50a

WINDOWS   | MS-DOS kbprg kbprb 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

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

Keywords         : FxprgBrowse Version          : 2.50 2.50a | 2.00 2.50 2.50a Platform         : MS-DOS WINDOWS
 * }