Article ID: 117709
Article Last Modified on 12/1/2003
PARENT.DBF CHILD.DBF
-----------------------------------------------------------
IDNO(C,5) NAMES(C,10) IDNO(C,5) CITIES(C,10)
111 Sam 114 Fairbanks
112 Mary 113 Houston
113 Beth 115 Phoenix
114 Larry 111 Dover
115 Pat 112 Buffalo
111 Dallas
112 Portland
*Open up the tables, and set up the one-to-many relationship
USE Parent IN 1
USE Child IN 2
SELECT Parent
INDEX ON IDNO TAG IDNO
SET ORDER TO IDNO
SELECT Child
INDEX ON IDNO TAG IDNO
SET ORDER TO IDNO
SELECT Parent
SET RELATION TO idno INTO Child
SET SKIP TO Child
SELECT Parent
*Information window, and the first BROWSE FIELDS command displays
*correctly
WAIT WINDOW "Please note how the tables line up appropriately." ;
+CHR(13)+"Hit ESC to continue" NOWAIT
BROWSE FIELDS parent.idno, parent.names, child.idno, child.cities
*Select another record in the child for testing purposes, often a
*SEEK() might be performed here in an actual meaningful program
SELECT child
GO BOTTOM
*Reselect Parent table
SELECT parent
*Information window, and the incorrect results from the BROWSE
*FIELDS command
WAIT WINDOW "Now they don't appear right!!" + CHR(13)+ ;
"Hit ESC to continue" NOWAIT
BROWSE FIELDS parent.idno, parent.names, child.idno, child.cities
*The resolution, an information window, and the corrected results
*from the BROWSE FIELDS command
GO RECNO()
WAIT WINDOW "That fixed it !!" + CHR(13) + "Hit ESC to continue" ;
NOWAIT
BROWSE FIELDS parent.idno, parent.names, child.idno, child.cities
Additional query words: VFoxWin FoxDos FoxWin 2.50 2.50a 2.50b refresh database
Keywords: KB117709