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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection from combo boxes

Status
Not open for further replies.

nina1

Programmer
Aug 14, 2001
31
0
0
CA
Hi,
For example I have 4 combo boxes filled with numbers(1 to 4)
and user can select one number from combo box, but based on sorting user can just select one combo box and leave the rest blank or can select all combo boxes.
I tried if statments, but that didn't work like this:
if combo1.text=1 then
xxxxxxx
elseif combo1.text=1 and combo2.text=2 then
xxxxxxx
end if

Thank you,
 
Nina,

I don't understand what you are asking. Try and explain some more. It often help to explain the purpose of that you are doing.

The code you show does not make sence for 2 reasons:
1) combo1.text is a string, it can never be 1 (which is a number). Change to val(combo1.text) = 1 or combo1.text = "1"
2) if combo1.text = "1" the first option will always be used. E.i. the 2nd option will never be used.

Good luck Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
From what you are describing you should first set up the combo boxes so that there is a specific order in which the combo box selections are made. So you could disable all the combo boxes other than the first combo box. Then set up the combo box "Change" event to enable the next combo box in line when there is text in the combo box. This would make your "If" statement easier to set up, but it won't be just one "If" statement to handle what you are explaining. You will need to use "nested" if statements as follows. Nested referring to "If" statements within the boundaries of another "If" statement.

Example:

if combo1.text <> &quot;&quot; then
if combo2.text <> &quot;&quot; then
if combo3.text <> &quot;&quot; then
if combo4.text <> &quot;&quot; then
xxxxxxxxxxxxxxxxx
else
xxxxxxxxxxxxxxxxx
end if
else
xxxxxxxxxxxxxxxxx
end if
else
xxxxxxxxxxxxxxxxx
end if
else
xxxxxxxxxxxxxxxxx
end if

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top