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

Like operator help......

Status
Not open for further replies.

andrest

Programmer
Jul 25, 2002
20
CA
How can I query a table using a variable instead of a string?

SELECT AuthorLastName FROM BookList
WHERE BookTitle LIKE '*Cook Book*'

It doesn't work like the following.

SELECT AuthorLastName FROM BookList
WHERE BookTitle LIKE '*VARIABLE*'

andrest
 
You might try the following for a string

"SELECT AuthorLastName FROM BookList
WHERE BookTitle LIKE '" & TheVarName & "%'"

Leave out the single quotes for a number.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top