View Full Version : The 'Select Case' statement


wan2fly99
01-22-2007, 05:10 AM
I have a a case Stament:

Select case (userid)


case 'AA'
formla = 10
case 'BB'
formula = 15
case 'CC'
case 'DD'
case 'EE'
formula = 20
case 'FF"
formula =25
end case


If my value i cc or dd or ee I do not get the value 20


I thought that when the values are cc dd ee it should fall thru into
that case stmt.


If I put ewach indiviudal one seperte it works

BarryMK
01-22-2007, 05:36 AM
Try


case 'AA'
formula = 10
case 'BB'
formula = 15
case 'CC' Or case 'DD' Or case 'EE'
formula = 20
case 'FF"
formula =25
end select

wan2fly99
01-22-2007, 06:05 AM
Okay, all these different languages do it slightly different.

will try with or

thanks

boblarson
01-22-2007, 06:56 AM
You don't need the OR in it just separate the multiple conditions in the single statement with a comma.


Case "AA"
formula = 10
Case "BB"
formula = 15
Case "CC","DD","EE"
formula = 20
Case "FF"
formula =25
End Select

Mile-O
01-23-2007, 06:46 AM
Regarding Crystal, there are two ways to use the select case: Crystal Syntax and Basic Syntax:

Taking the Basic Syntax above, here's the Crystal Syntax:


Select {field}
Case "AA": 10
Case "BB": 15
Case "CC","DD","EE": 20
Case "FF": 25
default: 0
;