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

Problem with Select Statement

Status
Not open for further replies.

mbaddar

Programmer
May 10, 2001
120
US
Hi,

I'm trying to write a query and I'm having a problem.
The query is a select statement that tries to bring back all
part descriptions that are similiar to a part description
a user might enter. I'd like to allow the user to be able to enter multiple descriptions such as "cylindrical, black."
Then, I would like to retrieve all records that have descriptions that contain any phrase (or portion of a phrase) entered by a user.

I've written the following select statement below, but it doesn't return any records. Does anyone see anything that I'm doing wrong?

When I just enter one of the phrases, like "Black" or "cylindrical" it returns records but when I enter both, nothing is returned.

Thanks a lot,
MBaddar

"Select * From Parts where Parts.Description Like " & "'" & txtDescription & "'"
 
If this is an Access 2000 database and you are using an ADO recordset object then use the % wildcard character.

"Select * From Parts where Parts.Description Like " & "'%" & txtDescription & "%'"

DAO recordset objects in Access 97 uses the * as a wildcard character.
 
Thanks very much, that was exactly right.

MBaddar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top