Case select question?

  • Thread starter Russ via AccessMonster.com
  • Start date
R

Russ via AccessMonster.com

Can you use case select like this, what is the proper way of writing it?

currently using it like this... Want to do it like this...
Case select optgroup1 Case select optgroup1
case 1 case 1 thru 3
case 2 case 4 thru 5
case 3
case 4
case 5

is this possible?
 
A

Allen Browne

No problem, Rus:

Select Case Me.OptGroup1.Value
Case 1 to 3
...
Case 4, 5
...
Case Else
...
End Select

Probably not relevant where you are using ranges, but I like to refer to the
option buttons by name so the code still works if the buttons are
rearranged:
Case Me.MyOptionButton.OptionValue
 
D

David C. Holley

Yes and its actually SELECT CASE

Case > 1 and < 5
VBA will change it to Case Is > 1 and Is < 5
 
R

Russ via AccessMonster.com

Thanks!

Allen said:
No problem, Rus:

Select Case Me.OptGroup1.Value
Case 1 to 3
...
Case 4, 5
...
Case Else
...
End Select

Probably not relevant where you are using ranges, but I like to refer to the
option buttons by name so the code still works if the buttons are
rearranged:
Case Me.MyOptionButton.OptionValue
Can you use case select like this, what is the proper way of writing it?
[quoted text clipped - 7 lines]
is this possible?
 
Top