Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Submenus for a combobox?
Message
From
13/10/1999 14:14:30
 
 
To
13/10/1999 13:36:06
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00275948
Message ID:
00275968
Views:
23
Hi Greg.

>> On a form I have a combo box in which I would like to display 20 or so different choices and depending on which item they choose, display the subset of choices linked to the initial selection? <<

You mean you want to filter the contents of a second combo or list depending on the selection made in the first? If this is the case, put code like this in the Init of your dependent combo or list (in my example it is called lstDetails):
*** Set up the SQL statement to use as the RowSource for the dependent 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.cboMaster.Value ) INTO CURSOR csrDetails '
lcRowSource = lcRowSource + 'ORDER BY UpperDesc'
*** Now set up the list box's properties
WITH This
  .RowSourceType = 3
  .RowSource = lcRowSource
  *** Don't forget to repopulate the control's internal list
  .Requery()
  *** Initialize it to display the first item
  .ListIndex = 1
ENDWITH	
You are probably safer to put this code in the form's init because if your 'master' combo is instantiated after your dependent list, you will get a runtime error.

Now put code like this in the Valid of the 'master' combo:
WITH Thisform
  .lstDetails.Requery()
  .lstDetails.ListIndex = 1
ENDWITH	
Marcia
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform