Using "and" for a parameter search in a query

G

Guest

I am trying to use a parameter search in my query to prompt the user to type
in parts of the field three times before the query will run. I have the
following input into the criteria field.....

Like "*" & [Input Part of Dwg Title] & "*" And Like "*" & [Input Another
Part of Dwg Title] & "*" And Like "*" & [Input Another Part of Dwg Title] &
"*"

It will run the first two prompts but not the third one. Is that because I
am using "and" which can only produce two results? What is a better way to
do this?

Thanks
 
S

Smartin

I am trying to use a parameter search in my query to prompt the user to type
in parts of the field three times before the query will run. I have the
following input into the criteria field.....

Like "*" & [Input Part of Dwg Title] & "*" And Like "*" & [Input Another
Part of Dwg Title] & "*" And Like "*" & [Input Another Part of Dwg Title] &
"*"

It will run the first two prompts but not the third one. Is that because I
am using "and" which can only produce two results? What is a better way to
do this?

Thanks

The prompts are treated like variables. In your case, the 2nd and 3rd
prompt have the same "variable name", so the response to the 2nd
serves as the response to the 3rd. All you need to do is change the
language in the third prompt.
 
J

John W. Vinson

I am trying to use a parameter search in my query to prompt the user to type
in parts of the field three times before the query will run. I have the
following input into the criteria field.....

Like "*" & [Input Part of Dwg Title] & "*" And Like "*" & [Input Another
Part of Dwg Title] & "*" And Like "*" & [Input Another Part of Dwg Title] &
"*"

It will run the first two prompts but not the third one. Is that because I
am using "and" which can only produce two results? What is a better way to
do this?

Thanks

You'll need to recapitulate the fieldname in each AND: the SQL would be

WHERE [DwgTitle] Like "*" & [Input Part of Dwg Title] & "*" And [DwgTitle]
Like "*" & [Input Another Part of Dwg Title] & "*" And [DwgTitle] Like "*" &
[Input Another Part of Dwg Title] & "*"


John W. Vinson [MVP]
 
G

Guest

JohnW said:
I am trying to use a parameter search in my query to prompt the user to type
in parts of the field three times before the query will run. I have the
following input into the criteria field.....

Like "*" & [Input Part of Dwg Title] & "*" And Like "*" & [Input Another
Part of Dwg Title] & "*" And Like "*" & [Input Another Part of Dwg Title] &
"*"

It will run the first two prompts but not the third one. Is that because I
am using "and" which can only produce two results? What is a better way to
do this?

Thanks
 
G

Guest

JohnW said:
I am trying to use a parameter search in my query to prompt the user to type
in parts of the field three times before the query will run. I have the
following input into the criteria field.....

Like "*" & [Input Part of Dwg Title] & "*" And Like "*" & [Input Another
Part of Dwg Title] & "*" And Like "*" & [Input Another Part of Dwg Title] &
"*"

It will run the first two prompts but not the third one. Is that because I
am using "and" which can only produce two results? What is a better way to
do this?

Thanks
[Input Another Part of Dwg Title] which is the 2nd parameter is the same as the 3rd parameter. Try using a text box on a form instead and reference it as forms!form_name!textbox_name..etc.
 
D

David W. Fenton

I am trying to use a parameter search in my query to prompt the
user to type in parts of the field three times before the query
will run. I have the following input into the criteria field.....

Like "*" & [Input Part of Dwg Title] & "*" And Like "*" & [Input
Another Part of Dwg Title] & "*" And Like "*" & [Input Another
Part of Dwg Title] & "*"

It will run the first two prompts but not the third one. Is that
because I am using "and" which can only produce two results? What
is a better way to do this?

Thanks

You'll need to recapitulate the fieldname in each AND: the SQL
would be

WHERE [DwgTitle] Like "*" & [Input Part of Dwg Title] & "*" And
[DwgTitle] Like "*" & [Input Another Part of Dwg Title] & "*" And
[DwgTitle] Like "*" & [Input Another Part of Dwg Title] & "*"

You can use Application.BuildCriteria to do that for you.
 

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