Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help About linking grids...

Status
Not open for further replies.

vfpshe

Programmer
Jan 2, 2001
24
US
Hello!

Im new to VFP and I need help with my form having 3 grids... One grid is a master, the next and third one are the child of the first...
i need to make it work in such a way that whatever is highlighted in the first grid will display the child records in the second and third...

is linkmaster and childorder the key to the solution?

please help....

=)
 
Check out the command:

SET RELATION TO, this links a parent table to hild tables.
It is explained clearly in the MSDN.

With SET RELATION TO a link is established between a parent table and its child tables, usually by a common field or index order. it establishes exactly what you want.

Weedz
veld4663@exact.nl

'It never hurts to help...' - Eek the cat.
 
i appreciate that weedz..

but where do i place that in the event/property of the grid?
 
fxshe

To help you get started, right click on the parent grid and select "Builder", whereupon a wizard type dialog form will appear.

Select the required fields and set the relationship to the child grid(s) by clicking on the end tab.

If you explore the DataEnvironment, you can examine the relationships between the tables.

Open up the grids as well and see how the relationships have been set up.

Once you understand the way these things work, you can dispense with the builders.

Hope this helps.

Chris
 
I generally open the tables in the init event of the form. If you are using a data session it does this for you. By the way are you using VFP tables or 2.6 tables That is are you using a database with tables or free standing tables.

Anyhow in the init I'd have code similar to this

if not Used(mastertable)
use mastertable order (tagname)
else
select mastertable
set order to (tagname)
end
*
if not used(childone)
use childone order (tagname of common key)
else
select childone
set order to (tagname of common key)
endif
*
if not used(childtwo)
use childtwo order (tagname of common key)
else
select childtwo
set order to (tagname of common key)
endif
*
select mastertable
set relation to common key into childone
set relation to common key into childtwo additive

Hope this helps

Bill Couture

 
thanks guys!!!
u're all great!!!

=)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top