Please Help with a query with two parameters

  • Thread starter Thread starter Emily
  • Start date Start date
E

Emily

Hi there,
I am trying to design a query that will allow the user to
enter in two words or phrases. For the Select Query, my
criteria are:

Like "*xxxxxxxx*" And Like "*yyyyyyy*"

which works just fine. But now I am trying to create a
parameter query and I am having trouble getting it to
work.

LIKE "*" & [Enter the first word to search by: ] &"*" AND
LIKE "*" [Enter the second word to search by:] "*"

Can anyone help???
Thanks so much!
 
Looks like you neglected to put the & symbol before and
after the second prompt string.

Hope this works.
 
Oops, that was my mistake retyping it into the message.
But no, when I type in the same words that I used for the
select query (which bring up results), this brings up
nothing.
-----Original Message-----
Looks like you neglected to put the & symbol before and
after the second prompt string.

Hope this works.

-----Original Message-----
Hi there,
I am trying to design a query that will allow the user to
enter in two words or phrases. For the Select Query, my
criteria are:

Like "*xxxxxxxx*" And Like "*yyyyyyy*"

which works just fine. But now I am trying to create a
parameter query and I am having trouble getting it to
work.

LIKE "*" & [Enter the first word to search by: ] &"*" AND
LIKE "*" [Enter the second word to search by:] "*"

Can anyone help???
Thanks so much!
.
.
 
Hi there,
I am trying to design a query that will allow the user to
enter in two words or phrases. For the Select Query, my
criteria are:

Like "*xxxxxxxx*" And Like "*yyyyyyy*"

which works just fine. But now I am trying to create a
parameter query and I am having trouble getting it to
work.

LIKE "*" & [Enter the first word to search by: ] &"*" AND
LIKE "*" [Enter the second word to search by:] "*"

Can anyone help???
Thanks so much!

Depending upon what you are trying to do, either one of these will
work.

To return only records that contain both words:

Where TbleName.FieldName Like "*" & [Enter Word 1] * "*" AND
TableName.FieldName Like "*" & [Enter Word 2] & "*"

To return only records that contain either word:

Where TbleName.FieldName Like "*" & [word 1] & "*" OR
TbleName.FieldName Like "*" & [word 2] & "*"
 
Hi again, Emily,
I think that the basic syntax that you, fredg and I are
using is correct; fredg gave you both the AND and OR
solutions.
I'm puzzled that these don't work, except that MAYBE
you're expecting something back that the data simply don't
contain. If you're still having trouble, give us a sample
of record fields that you want the query to extract
(including some that should NOT be found and some that
SHOULD), and either of us will pick up from there.
I'll look for your post on Monday. Let us know whether
you found the answer - this is not a toughie. Good luck!

hj
-----Original Message-----
Oops, that was my mistake retyping it into the message.
But no, when I type in the same words that I used for the
select query (which bring up results), this brings up
nothing.
-----Original Message-----
Looks like you neglected to put the & symbol before and
after the second prompt string.

Hope this works.

-----Original Message-----
Hi there,
I am trying to design a query that will allow the user to
enter in two words or phrases. For the Select Query, my
criteria are:

Like "*xxxxxxxx*" And Like "*yyyyyyy*"

which works just fine. But now I am trying to create a
parameter query and I am having trouble getting it to
work.

LIKE "*" & [Enter the first word to search by: ] &"*" AND
LIKE "*" [Enter the second word to search by:] "*"

Can anyone help???
Thanks so much!
.
.
.
 
Thanks so much for your help with this! I don't know why
it didn't work on Friday, but today I looked at it with
rested eyes, and it's doing what I want! I am working
with a lot of scientific terms, and that may have been
part of the issue here.
In any case, it works today, and I appreciate the time
spent answering me!
Emily
-----Original Message-----
Hi there,
I am trying to design a query that will allow the user to
enter in two words or phrases. For the Select Query, my
criteria are:

Like "*xxxxxxxx*" And Like "*yyyyyyy*"

which works just fine. But now I am trying to create a
parameter query and I am having trouble getting it to
work.

LIKE "*" & [Enter the first word to search by: ] &"*" AND
LIKE "*" [Enter the second word to search by:] "*"

Can anyone help???
Thanks so much!

Depending upon what you are trying to do, either one of these will
work.

To return only records that contain both words:

Where TbleName.FieldName Like "*" & [Enter Word 1] * "*" AND
TableName.FieldName Like "*" & [Enter Word 2] & "*"

To return only records that contain either word:

Where TbleName.FieldName Like "*" & [word 1] & "*" OR
TbleName.FieldName Like "*" & [word 2] & "*"

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
.
 
Back
Top