SEARCH TWO FIELDS-MATCH BOTH

  • Thread starter Jan via AccessMonster.com
  • Start date
J

Jan via AccessMonster.com

In the query criteria of field Description1 I have Like [Enter Description
1] & "*" and stepped down in the OR criteria for Description2 I have Like
[Enter Description 2] & "*". The user needs to be able to "global" search
the fields but as I have the criteria set it seems to list "either/Or" . I
want it to find only records that match Description1 and Description2.
Example: If the user enters "Pencil" then "Red" I only want records that
have Pencil in the first description field AND Red in the second.

I've search the query threads but have not found this example requested yet.

Thanks
 
R

Rick B

Then put the criteria on the same row in the design grid to create and "AND"
condition. Separate rows create "OR" conditions.
 
M

MGFoster

Jan said:
In the query criteria of field Description1 I have Like [Enter Description
1] & "*" and stepped down in the OR criteria for Description2 I have Like
[Enter Description 2] & "*". The user needs to be able to "global" search
the fields but as I have the criteria set it seems to list "either/Or" . I
want it to find only records that match Description1 and Description2.
Example: If the user enters "Pencil" then "Red" I only want records that
have Pencil in the first description field AND Red in the second.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Both criteria should be on the same line, that will give the AND
evaluation.

Description1 Description2
Like [Enter Description1] & "*" Like [Enter Description2] & "*"

Switch to the SQL view & look at the WHERE clause it should look like
this:

WHERE Description1 Like [Enter Description1] & "*" AND Description2 Like
[Enter Description2] & "*"

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRFJsQ4echKqOuFEgEQKfDACglgYOHQkmfIB5ufQwg7PfsD56phQAniIc
0ShbUbOcW57AMQxpIb88tALw
=1o2P
-----END PGP SIGNATURE-----
 
J

Jan via AccessMonster.com

Thank you both for replying. This forum has taught me so much and has been
so helpful with my development of db's.
In the query criteria of field Description1 I have Like [Enter Description
1] & "*" and stepped down in the OR criteria for Description2 I have Like
[quoted text clipped - 3 lines]
Example: If the user enters "Pencil" then "Red" I only want records that
have Pencil in the first description field AND Red in the second.

Both criteria should be on the same line, that will give the AND
evaluation.

Description1 Description2
Like [Enter Description1] & "*" Like [Enter Description2] & "*"

Switch to the SQL view & look at the WHERE clause it should look like
this:

WHERE Description1 Like [Enter Description1] & "*" AND Description2 Like
[Enter Description2] & "*"
 

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