The 'Select Case' statement (1 Viewer)

wan2fly99

Registered User.
Local time
Today, 06:57
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
 

BarryMK

4 strings are enough
Local time
Today, 14:57
Joined
Oct 15, 2002
Messages
1,352
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

Registered User.
Local time
Today, 06:57
Joined
Feb 7, 2005
Messages
53
Okay, all these different languages do it slightly different.

will try with or

thanks
 

boblarson

Smeghead
Local time
Today, 06:57
Joined
Jan 12, 2001
Messages
32,059
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
 

Mile-O

Back once again...
Local time
Today, 14:57
Joined
Dec 10, 2002
Messages
11,316
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
;
 

Mahoney

Registered User.
Local time
Today, 06:57
Joined
Feb 4, 2009
Messages
28
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

Top Bottom