BUG: Inconsistant Results with SET RELATION TO Command (158240)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q158240

SYMPTOMS

Issuing the SET RELATION TO command repeated times within a program causes inconsistent results to appear in Browse windows and in Grids. While cycling through the program, some iterations do not show the proper one-to- many relationships between records in the Browse window or Grid object. The placeholder characters (asterisks) in the child record appear in different columns when you repeatedly executes the program.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

The code example below illustrates this behavior.

Steps to Reproduce Behavior

  1. Create a program called Test that contains the following code:
          IF !(FILE('custfree.dbf') AND FILE('ordfree.dbf');
             AND FILE('ordifree.dbf'))
          CLOSE ALL
          SET DEFAULT TO c:\vfp5\samples\DATA
          USE customer
          COPY TO custfree
          USE orders
          COPY TO ordfree
          USE orditems
          COPY TO ordifree
          USE ordifree
          INDEX ON order_id TAG order_id
          USE ordfree
          INDEX ON cust_id TAG cust_id
          USE custfree
          INDEX ON cust_id TAG cust_id
          ENDIF
    
          CLOSE ALL
    
          ON KEY LABEL f2 CLEAR EVENTS
          FOR i=1 TO 10
    
          CLOSE ALL
    
          OPEN DATABASE testdata
    
          USE customer
    
          SELECT 0
          USE ordifree
          SET ORDER TO TAG order_id
    
          SELECT 0
          USE ordfree
          SET ORDER TO TAG cust_id
          SET RELATION TO order_id INTO ordifree
    
          SET SKIP TO ordifree
    
          SELECT 0
          USE custfree
          SET RELATION TO cust_id INTO ordfree
    
          SET SKIP TO ordfree,ordifree
          BROW LAST FIELDS custfree.cust_id,ordfree.order_id, ;
             ordifree.line_no NOWAIT TITLE 'two'
          READ EVENTS
    
          NEXT
          ON KEY LABEL f2
          CLOSE ALL
          CLEAR ALL
    							
  2. Execute the program and note that asterisk characters appear in the Order_id field and data appears in the Line_no field.
  3. Press F2 and note that the display reverses. The Line_no field now contains asterisk characters and the Order_id field contains data. As you continue to press F2 to reissue the SET RELATION TO command, these fields continue to alternate their contents.

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:KB158240