Claude,
The ChildOrder has to be the index on the foreign key that is linking the child table to the parent table. If you are using another index then you WILL get blank grids.
HTH
Barbara
>Thanks all, but still not working.
>I tried several ways. It seems like the ChildOrder property is causing problem. My form is very simple: two grids, two tables in Dataenvironment.
>
>In form designer grid1.RecordSource = table1
> grid2.RecordSource = table2
> grid2.RelationnalExpr = field1
> grid2.LinkMaster = table1
>With those settings, both grids show all records of table1 and table2 which is correct.
>If I add grid2.ChildOrder = field2, then grid2 is empty when I run the form!!!
>
>I also tried to add a relation in form.load():
>
ThisForm.DataEnvironment.CloseTables
> ThisForm.DataEnvironment.AddObject('newRelation','Relation')
> ThisForm.DataEnvironment.newRelation.ChildOrder='field2'
> ThisForm.DataEnvironment.newRelation.RelationalExpr='field1'
> ThisForm.DataEnvironment.newRelation.ChildAlias='table2'
> ThisForm.DataEnvironment.newRelation.ParentAlias='table1'
> ThisForm.DataEnvironment.OpenTables
>
>
>This produces also an empty grid2!!!
>
>Third way:
>With only RecordSource property of both grids set, I ran the form with dataSession window opened and created my relation from the dataSession window. Once the relation is created, grid2 responds correctly to selection made in table1.
>If this method worked, why didn't method 2 work out?
>
>
>I'm using Visual FoxPro 5.0.
>Is this a bug, is it fixed in 5.0a or 6.0??
>
>Thank you
>Claude