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!

If Statement with Like - Help... 1

Status
Not open for further replies.

Basia

Programmer
Apr 27, 2001
64
ML
I am trying to set up an if statement using "like."

Here is the If:

If varTitle = "Manager" then
process
End If

How do I make sure that anyone who has Manager in their title gets processed? Would it be the same for a Select Statement?

Any help is much appreciated!
Basia
 
Try this
If varTitle = "*Manager*" then
process
End If

I believe that in some forms of SQL, you have to use the % as the wildcard
HTH
Geoff
 
Thanks for you quick response. I have tried the wild cards **, but it still does not catch the records. Any other thoughts?

Basia
 
Sorry - use the LIKE keyword
If varTitle LIKE "*manager*" then
process
etc etc
HTH
Geoff
 
Works perfectly!

Thank you so much!!!

Basia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top