Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Two Listboxes and Parent->Child Relationship
Message
From
07/10/2004 09:53:06
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Two Listboxes and Parent->Child Relationship
Miscellaneous
Thread ID:
00949516
Message ID:
00949516
Views:
62
I have two listboxes on a form. One displays the fields on a parent table and one displays the fields on a child table. I do NOT want to filter the child records so that only the matching child records display in the child listbox. Instead, I want all records in the child table to display in the child listbox. However, when the user manueuvers through the parent table in the parent listbox, I want the listindex on the child listbox to be the recno for the matching record in the child table.

Both listboxes are setup as Fields and display the foreign index key in column 1.

The relationship is as follows:
SELE BRIDGES && parent table
SET ORDER TO TAG compsort && BRIDGEKEY + COMPANY
SELE LBRIDGES && child table
SET ORDER TO TAG BRIDGEKEY && foreign key
SELE BRIDGES
SET RELATION TO BRIDGEKEY INTO LBRIDGES ADDITIVE
GO TOP

I have the following code in the interactive change event of the parent listbox but it only works if focus is shifted to the child listbox:

*this is lstbridges.interactivechange event - parent listbox
*lstlbridges is the child listbox
thisform.currentbridge = bridges.bridgekey
thisform.lstlbridges.listindex = RECNO('lbridges')
thisform.ifield.refresh() && control displays the child listbox's listindex
thisform.Refresh

I know the record pointer is moving as it should in the child table because I have another field on the form that displays the values in the child table and they change to the appropriate values for the matching record in the child table when I step through the records in the parent table in the parent listbox.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform