PRB: Inconsistant Results with SET RELATION TO Command

Last reviewed: January 13, 1997
Article ID: Q158240
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0

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 is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.

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.


KBCategory: kbprg kbprb
KBSubcategory: FxprgRelation
Additional reference words: kbdse 3.00 3.00b 5.00 VFoxWin



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: January 13, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.