CASE select

  • Thread starter Thread starter Squibbly
  • Start date Start date
S

Squibbly

sorry i seemed to have forgotten how to start up a CASE select function can
someone please tell me how this is done
ok i know i must start revising it again in the meantime
 
Not really sure what you're asking for.

Are you asking how to use the Select Case statement?

That's

Select Case <expression to test on>
Case <expression list 1>
<statements to execute>
Case <expression list 2>
<statements to execute>
Case Else
<statements to execute>
End Select

An example (from the Help file) is

Dim lngNumber As Long
lngNumber = 8 ' Initialize variable.
Select Case lngNumber ' Evaluate Number.
Case 1 To 5 ' Number between 1 and 5.
Debug.Print "Between 1 and 5"
Case 6, 7, 8 ' Number between 6 and 8.
Debug.Print "Between 6 and 8"
Case Is > 8 And Number < 11 ' Number is 9 or 10.
Debug.Print "Greater than 8"
Case Else ' Other values.
Debug.Print "Not between 1 and 10"
End Select

Or are you asking for how to put the equivalent of a Case statement in a
Select query? Depending on your needs, you could use nested IIf statements,
or the Choose statement or the Switch statement.
 
yup thats what i was looking for thanks


Douglas J. Steele said:
Not really sure what you're asking for.

Are you asking how to use the Select Case statement?

That's

Select Case <expression to test on>
Case <expression list 1>
<statements to execute>
Case <expression list 2>
<statements to execute>
Case Else
<statements to execute>
End Select

An example (from the Help file) is

Dim lngNumber As Long
lngNumber = 8 ' Initialize variable.
Select Case lngNumber ' Evaluate Number.
Case 1 To 5 ' Number between 1 and 5.
Debug.Print "Between 1 and 5"
Case 6, 7, 8 ' Number between 6 and 8.
Debug.Print "Between 6 and 8"
Case Is > 8 And Number < 11 ' Number is 9 or 10.
Debug.Print "Greater than 8"
Case Else ' Other values.
Debug.Print "Not between 1 and 10"
End Select

Or are you asking for how to put the equivalent of a Case statement in a
Select query? Depending on your needs, you could use nested IIf
statements, or the Choose statement or the Switch statement.
 
Back
Top