Select Case of with more variables

Posted on 2008-01-30
Medium Priority
Last Modified: 2008-03-17
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 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
   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.
Question by:ggmisadmin
LVL 13

Accepted Solution

rettiseert earned 375 total points
ID: 20779395
mmm... how about...

Dim CM, Carrier, Destinatio
Dim AllThreeResults


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
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....



Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question