The 'Select Case' statement

wan2fly99

Registered User.
Local time
, 19:41
Joined
Feb 7, 2005
Messages
53
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
 
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
 
Okay, all these different languages do it slightly different.

will try with or

thanks
 
You don't need the OR in it just separate the multiple conditions in the single statement with a comma.

Code:
Case "AA"
   formula = 10 
Case "BB" 
   formula = 15 
Case "CC","DD","EE" 
   formula = 20 
Case "FF" 
   formula =25 
End Select
 
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:

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

I am having a problem with a select case the code is

Private Sub DispatchBy_AfterUpdate()
Select Case DispatchBy

Case "Email"
Me.AWB.Enabled = False
Me.TapeFormat.Enabled = False

Case "Satellite"
Me.AWB.Enabled = False
Me.TapeFormat = True

Case "UPS", "DHL", "Sky Net", "Aramex", "FedEx"
Me.AWB.Enabled = True
Me.TapeFormat.Enabled = True

End Select
End Sub

I even tried the if then statement and it did not work, i am assuming that there is a problem somewhere else, but can figure it out
could it be that this form is a subform on another form?
could it be the control source or row source which is from a table called courier companies?
Could it be the indenting when writing a code

Please help, I am i've been plling my hair from it for the past 4 days, and only a few hairs are left, save them please

thank you
 

Users who are viewing this thread

Back
Top Bottom