Running Query from form with wildcards

B

bymarce

Based on a previous post, I used [Forms]![Search Form]![MLO #] in my query to
refer to my form and put a command button to run the query. The MLO # is a
catalog number in the form of ####-####. I am able to run the query for
exact matches to the entire field but it doesn't work for ranges or matches
to part of the field. Is there a way to use wild cards on the form? I've
tried typing an expression on the form as I would on the query, such as
####-####. I also have a column for desciption refered to as
[Forms]![Search Form]![Description] in my search. For this column we usually
search with * because the search criteria is only part of the field. In the
form I tried using *criteria* and it didn't return anything. Also in the
query I tried putting *[Forms]![Search Form]![Description]* and access
changes it to Like "*[Forms]![Search Form]![Description]*". Thanks for the
help.
ByMarcie
 
D

Douglas J. Steele

Try changing that to

Like "*" & [Forms]![Search Form]![Description] & "*"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


bymarce said:
Based on a previous post, I used [Forms]![Search Form]![MLO #] in my query
to
refer to my form and put a command button to run the query. The MLO # is
a
catalog number in the form of ####-####. I am able to run the query for
exact matches to the entire field but it doesn't work for ranges or
matches
to part of the field. Is there a way to use wild cards on the form? I've
tried typing an expression on the form as I would on the query, such as
####-####. I also have a column for desciption refered to as
[Forms]![Search Form]![Description] in my search. For this column we
usually
search with * because the search criteria is only part of the field. In
the
form I tried using *criteria* and it didn't return anything. Also in the
query I tried putting *[Forms]![Search Form]![Description]* and access
changes it to Like "*[Forms]![Search Form]![Description]*". Thanks for
the
help.
ByMarcie
 
B

bymarce

Thankyou very much. It worked.
ByMarce

Douglas J. Steele said:
Try changing that to

Like "*" & [Forms]![Search Form]![Description] & "*"

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


bymarce said:
Based on a previous post, I used [Forms]![Search Form]![MLO #] in my query
to
refer to my form and put a command button to run the query. The MLO # is
a
catalog number in the form of ####-####. I am able to run the query for
exact matches to the entire field but it doesn't work for ranges or
matches
to part of the field. Is there a way to use wild cards on the form? I've
tried typing an expression on the form as I would on the query, such as
####-####. I also have a column for desciption refered to as
[Forms]![Search Form]![Description] in my search. For this column we
usually
search with * because the search criteria is only part of the field. In
the
form I tried using *criteria* and it didn't return anything. Also in the
query I tried putting *[Forms]![Search Form]![Description]* and access
changes it to Like "*[Forms]![Search Form]![Description]*". Thanks for
the
help.
ByMarcie
 

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