Is This Possible?

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

Is it possible to have an if statement in a case, and if a condition is meet
then it runs the suggested case?
Thanks
DS

Select Case
Case 1
'Do Whatever
Case 2
'Do Whatever
Case 3
If Me.Text1 =1 Then
Run Case 1
Else
'Do Whatever
End If
End Select
 
Assuming that you mean that if it's case 3 And Me.Text1 = 1 you want the
same code as in case 1 to run, use:

Select Case SomeVariable
Case 1, 3
If SomeVariable = 1 Or Me.Text1 =1 Then
'Do Case 1 code
Else
'Do Case 3 code
End If
Case 2
'Do Case 2 code
Case 3
End Select
 
Back
Top