Multiple Parameters to search a field

W

Wild Bill

I am working on a form that will generate a query based on 1-3 key
words the user will enter into three unbound text boxes.

The field that the parameters are used on is a memo field. The Like
operator is not working with OR for me. The IN operator appears to
only like single strings in a field.

I have searched the forum and cannot see anything that fits my
situation.

Thank you in advance for any ideas.

Cheers,
Bill
 
J

John W. Vinson

I am working on a form that will generate a query based on 1-3 key
words the user will enter into three unbound text boxes.

The field that the parameters are used on is a memo field. The Like
operator is not working with OR for me. The IN operator appears to
only like single strings in a field.

I have searched the forum and cannot see anything that fits my
situation.

Thank you in advance for any ideas.

Cheers,
Bill

This gets tricky because of the optional boxes. A criterion such as

LIKE "*" & [Forms]![yourformname]![Textbox1] & "*" OR LIKE "*" &
[Forms]![yourformname]![Textbox2] & "*" OR LIKE "*" &
[Forms]![yourformname]![Textbox3] & "*"

will return all records if one box is left unfilled. If there is some text
string such as ~~~~ which will never be in the field you could use

LIKE "*" & NZ([Forms]![yourformname]![Textbox1],"~~~~") & "*"
OR LIKE "*" & NZ([Forms]![yourformname]![Textbox2],"~~~~") & "*"
OR LIKE "*" & NZ([Forms]![yourformname]![Textbox3],"~~~~") & "*"

but some VBA code on the form to construct a SQL string based on the actual
user input may be more efficient.
 

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