Solved

# Select Case of with more variables

Posted on 2008-01-30
Medium Priority
566 Views
Hello everybody,
I have three dropdown menus (lets say: Drop1, Drop2, Drop3) with three options each (lets say: A, B, C) and I would like to consider all the possible combinations once a user submit a form where those dropmenu are included.
If I pass those value as :
Dim CM, Carrier, Destinatio
CM=request.form(Drop1)
Carrier=request.form(Drop2)
Destinatio=request.form(Drop3)
CM could A or B (same as  Carrier and Destination)
Now instead of having nested If..then ElseIF ....confusing condition:
IF CM=A and Carrier=A THEN
IF Dest=A THEN
(........)
ELSEIF DEST=B
(.....)
End IF
ELSEIF CM=A and Carrier=B
.............
Is there a way to consider all the combinations but using another method such as "select case of" so that it wuold look more clear to read.
Thank you.

0

LVL 13

Accepted Solution

rettiseert earned 375 total points
ID: 20779395

Dim CM, Carrier, Destinatio
Dim AllThreeResults

CM=request.form(Drop1)
Carrier=request.form(Drop2)
Destinatio=request.form(Drop3)

AllThreeResults = CM & "|" & Carrier & "|" & Destinatio

select case AllThreeResults
Case "A|A|A":
Case "A|A|B":
Case "A|A|C":
Case "A|B|A":
....
end select
0

LVL 65

Expert Comment

ID: 20780882
Do you *really* to do something unique based on each individual combination?  What is the action that you might take based on a combination?  The reason I ask is because if rather than nest it, you just go through each select box one after the other, you might still be able to do the same thing....

Regards,

Rob.
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.