Select Case Between

L

Lamar

I have users enter numbers in a text box on a form. What operator can I use
with 'Select Case' to get same result when you use the 'Between" operator in
a query? I need determine is the entered number is 'between' two values. I
can not use 'Between' with Select Case. See code below. Thank you for any
help.

Dim intNumber as Integer

intNumber = Me.txtNumber 'text box where entered number

Select Case intNumber
Case Is Between 0 and 10
GoTo Number10

Case Is Between 11 and 20
GoTo Number20

Case Else
End Select
 
G

George Nicholson

Select Case yada_yada
Case 0 to10

Case 11 to 20

Case 21 to 30, 35, "Tuesday", Is > 90

Case Else

End Select
 
S

Stuart McCall

Lamar said:
I have users enter numbers in a text box on a form. What operator can I
use
with 'Select Case' to get same result when you use the 'Between" operator
in
a query? I need determine is the entered number is 'between' two values.
I
can not use 'Between' with Select Case. See code below. Thank you for
any
help.

Dim intNumber as Integer

intNumber = Me.txtNumber 'text box where entered number

Select Case intNumber
Case Is Between 0 and 10
GoTo Number10

Case Is Between 11 and 20
GoTo Number20

Case Else
End Select

In a select case statement you can specify ranges of values with <value1> To
<value2> :

Select Case intNumber
Case 0 To 10
GoTo Number10
Case 11 To 20

etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top