colonelblue
asked on
HOw to use a dynamic filed value in a Select Case statement?
Instead of using many if/else statements I thought I'd use Select Case Statements.
But the variable I'm trying to use is from a database field and I can't get the two working.
This is what I have.
<%
Select Case (RS_Event.Fields.Item("loc ation").Va lue)
Case "A"
result = "Alpha Station"
Case "D"
result = "Delta Station"
Case "AA"
result = "All Stations"
End Select
%>
What am I doing wrong?
Thank you in advance.
But the variable I'm trying to use is from a database field and I can't get the two working.
This is what I have.
<%
Select Case (RS_Event.Fields.Item("loc
Case "A"
result = "Alpha Station"
Case "D"
result = "Delta Station"
Case "AA"
result = "All Stations"
End Select
%>
What am I doing wrong?
Thank you in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't know.
How do I response write a Select Case statement named after the filed it is getting the variable from?
That is the conundrum to me.
How do I response write a Select Case statement named after the filed it is getting the variable from?
That is the conundrum to me.
ASKER
I figured it out.
Thanks for the help.
Thanks for the help.
<%
building = (RS_Events.Fields.Item("location").Value)
Select Case building
Case "A"
response.write("Alpha Station")
Case "D"
response.write("Delta Station")
Case "AA"
response.write("All Stations")
Case Else
response.write("Not Specified")
End Select
%>
ASKER
This one's got me scratching my head.
OK here's my code but how does it link together?
Location can only be one of three values, A, W, or BO.
It is a loop going through a table.
AT the moment the values, just show as A, W, or BO.
But I'd like A to show up as Alpha Station,
D as Delta Station, etc..
I can do it with if/else statements but thought a Select Case might make it simpler.
Open in new window