Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
From 1 combobox to another
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00391237
Message ID:
00393273
Views:
13
>>>>>>>a simple exercise I am looking to solve. I have combo1 with values from a field and another combo2 the same but I want combo2 choices to be limited depending on the value of combo1. Can you tell me where I put the code for this?
>>>>>>>thanks
>>>>>>
>>>>>>Hmm, may be set the Combo2.RowSourceType to 3 -SQL Statement, which SQL will depend on value selected in Combo1? Then you call
>>>>>>Combo2.Requery()
>>>>>>Combo2.Refresh()
>>>>>>in Combo1.Valid() or Combo1.InteractiveChange()
>>>>>
>>>>>and in Combo1.Init (or in Form.Init, to be sure, in order to initialize the second combo properly at first time...)
>>>>
>>>>That's correct.
>>>
>>>Each time I do this I find myself saying "Oh yeah, I forgot to add this to the form.init() again..." :)
>>
>>Can you tell me where the sql code is inserted and also in using sql so I don't end up with a browse screen as a result of my select?
>
>The SQL itself goes to Combo.RowSource property.
>
>Combo.RowSourceType = 3
>myCombo.RowSource = "SELECT myfield from mytable where somefield = somevalue INTO cursor myCombo1Source"
>
>This way you will not get a Browse window.
>Don't forget to close that cursor in Combo.Destroy()
>
>*Combo.Destroy()
>IF USED(" myCombo1Source")
>USE IN myCombo1Source
>ENDIF

An example of what I am trying to do is: if mylistbox1.value ='TURTLE' (from table1), I want comboxbox1 to show only 'TURTLE' (from table2)
"Build a man a fire, and he's warm for a day.
Set a man on fire, and he's warm for the rest of his life."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform