Query Question- LIKE

R

Rag742

I downloaded the contract management database for Access2003. I have
two questions
1. The contact management has a field titled "Subject" I have changed
it from" Text" to "Memo" Data Type. I created a query to search for
Like "asbestos" in Subject Field to display all records with
"asbestos" in the Subject Field. For some reason this is not working??
I tried changing the datatype to Text but no success.
2. How do I create a query with Query parameter to search for say"
asbestos" in the subject field at the run time. This way I can search
the Records that contain different Item at Run time-say "Asbestos";
"Lead","PVC" etc. Instead of creating a query for every topic. Thanks.
Rag742
 
J

John W. Vinson

I downloaded the contract management database for Access2003. I have
two questions
1. The contact management has a field titled "Subject" I have changed
it from" Text" to "Memo" Data Type. I created a query to search for
Like "asbestos" in Subject Field to display all records with
"asbestos" in the Subject Field. For some reason this is not working??

Like "asbestos" as a criterion will return all records where the COMPLETE TEXT
of the field (whether text or memo, makes no difference) is the word
"asbestos". If you want to find the word "asbestos" embedded within other
text, you must use a "wildcard"; in Access, the wildcard character * matches
any string of characters, so

LIKE "*asbestos*"

would find the word anywhere within the field.
I tried changing the datatype to Text but no success.
2. How do I create a query with Query parameter to search for say"
asbestos" in the subject field at the run time. This way I can search
the Records that contain different Item at Run time-say "Asbestos";
"Lead","PVC" etc. Instead of creating a query for every topic. Thanks.
Rag742

LIKE "*" & [Enter search term:] & "*"

will prompt you for the term and find it anywhere within the string.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top