Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If statement

Status
Not open for further replies.

darinmc

Technical User
Feb 27, 2005
171
GB
Code:
If Forms!frmSwitchboard!tPassID = 1 Or Forms!frmSwitchboard!tPassID = 8 Or Forms!frmSwitchboard!tPassID = 3 Or Forms!frmSwitchboard!tPassID = 2 Or Forms!frmSwitchboard!tPassID = 4 Then

Is there a way to write this in a LESS lengthy way?

Thx
Darin
 




Hi,
Code:
select case Forms!frmSwitchboard!tPassID 
  case 1, 8, 3, 2, 4
    'do something
end select


Skip,

[glasses]Have you heard that the roundest knight at King Arthur's round table was...
Sir Cumference![tongue]
 

I like the Select way, but if you really want to stick with an IF statement....
Code:
If InStr("*1*8*3*2*4*", "*" & Forms!frmSwitchboard!tPassID & "*") Then
    [green]'do something[/green]
End If

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top