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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Or operator

Status
Not open for further replies.

RichyT

Technical User
Jun 11, 2002
20
GB
I can't seem to find the syntax for the or operator so that I can compare a string to a list of strings, eg.

myString Like "one" or "two" or "three"

I feel like I'm being a bit dim!!

Cheers

Rich
 
I think you mean

((myString = "one") Or (myString = "two") Or (myString = "three"))


QED ?

G LS
 
Yes, I knew about that syntax, sorry should have mentioned that, but is there no way of doing it so that I don't have to keep repeating myString?

Rich
 
Not without setting up an array of potential answers and looping through it and then you have the extra typing to set up the loop

Only other way that springs to mind is
Select Case myString
Case "one"
goto linereference
case "two"
goto linereference
case "three"
goto linereference
case else
goto different linereference
End Select

HTH
Geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top