Hello. Thanks for the help.
I have a form where I am using an if/then code to open a subform.
Example:
If Color = "Red" Then
Do this
ElseIf Color ="Blue" Then
Do This
ElseIf
'Any other......
I want to know if there is a way to make one of my ElseIf selections
have more than one option. Something like:
If Color = "Red" Then
Do this
ElseIf Color = "Blue" Then
Do This
ElseIf Color = "Orange" Or "Purple" Or "Yellow"
Do This
Thanks Again.
Roger Carlson - 01 May 2008 18:19 GMT
ElseIf Color = "Orange" Or Color = "Purple" Or Color = "Yellow" Then
Or you could also use a Case Statement
Select Case Color
Case "Red"
Debug.Print "Do This"
Case "Blue"
Debug.Print "Do That"
Case "Orange", "Purple", "Yellow"
Debug.Print "Do the other thing"
Case Else
Debug.Print "Do the last thing"
End Select

Signature
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
> Hello. Thanks for the help.
>
[quoted text clipped - 20 lines]
>
> Thanks Again.
B. Edwards - 01 May 2008 18:21 GMT
IF color = "Red" then
' do stuff
ELSEIF color = "Orange" OR color = "Purple" OR color = "Yellow"
' do other stuff
ELSE
' do default stuff
END IF
Personally, though I would probably:
1. use a CASE statement
or
2. create a lookup table that contains the color and the name of the subform
and then perform a lookup to retrieve the name of the form to open based on
the color.
or
3. use arrays in a similar fashion to #2
or
4. if the user is picking a color use a two column combo box that contains
the color in one column and the formname in a second hidden column
> Hello. Thanks for the help.
>
[quoted text clipped - 20 lines]
>
> Thanks Again.
nybaseball22@gmail.com - 01 May 2008 22:17 GMT
Thank you both very much. Works like a charm.