Multiple Parameters to search a field

  • Thread starter Thread starter Wild Bill
  • Start date Start date
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
 
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.
 
Back
Top