LOCAL lcRowSource *** Set up the SQL statement to use as the RowSource for the Categories combo box *** Select only the items that have a Cat_No equal to the option selected in the option group *** The option group is bound to Thisform.nType and that property is initialized to 1 lcRowSource = 'SELECT Cat_Desc, Cat_Key, UPPER( Categories.Cat_Desc ) AS UpperDesc ' lcRowSource = lcRowSource + 'FROM Categories WHERE Categories.Cat_No = ( Thisform.nType ) ' lcRowSource = lcRowSource + 'INTO CURSOR csrCategories ORDER BY UpperDesc' *** Now set up the combo's properties WITH Thisform.cboCategories .RowSourceType = 3 .RowSource = lcRowSource *** Don't forget to repopulate the control's internal list .Requery() *** Inialize it to display the first item .ListIndex = 1 ENDWITH *** Set up the SQL statement to use as the RowSource for the detail list box *** Select only the items that have a De_Cat_Key equal to the Item selected in the combo box lcRowSource = 'SELECT Det_Desc, Det_Key, UPPER( Details.Det_Desc ) as UpperDesc FROM Details ' lcRowSource = lcRowSource + 'WHERE Details.De_Cat_Key = ( Thisform.nCategory ) INTO CURSOR csrDetails ' lcRowSource = lcRowSource + 'ORDER BY UpperDesc' *** Now set up the list box's properties WITH Thisform.lstDetails .RowSourceType = 3 .RowSource = lcRowSource *** Don't forget to repopulate the control's internal list .Requery() *** Inialize it to display the first item .ListIndex = 1 ENDWITH </re> Now, this code in the option group's valid, requeries the combo and list boxes based on what is selected in the option group: <pre> WITH Thisform .cboCategories.Requery() .cboCategories.ListIndex = 1 .lstDetails.Requery() .lstDetails.ListIndex = 1 ENDWITHAnd this code in the combo's valid, requeries the dependent list box:
WITH Thisform .lstDetails.Requery() .lstDetails.ListIndex = 1 ENDWITHSET PLUG ON