Building two expressions in one query

  • Thread starter instereo911 via AccessMonster.com
  • Start date
I

instereo911 via AccessMonster.com

good morning,

i have a database which has the following columns on a table:

Unit | Associate | Date | Data 1 | Data 2 |

I want to have a query that says the following:

Only filter in unit "NN" and "NF" -

and also

Only filter in the following criteria - Unit "EF" with Associate "81" -
everything else besides EF 81 filter out.

I am not sure how to accomplish this. I can't build it in the query... and
don't much about VBA.

thank you everyone again
 
G

Guest

Only filter in unit "NN" and "NF" Try:

Select * From TableName Where Unit In ("NN","NF")

Or, in design view the criteria under the unit will be
In ("NN","NF")

************************
Only filter in the following criteria - Unit "EF" with Associate "81" -
everything else besides EF 81 filter out.

Select * From TableName Where Unit = "EF" And Associate = "81"

The criteria under Unit will be
"EF"
And the criteria under Associate will be
"81"

Note: If the Associate field type is numeric then drop the double quote
***************************
To combine the two criteria's if needed:
Select * From TableName Where (Unit = "EF" And Associate = "81") Or Unit In
("NN","NF")
 
J

John Spencer

So you want all records for units NN and NF plus records where Unit EF and
Associate = 81

SELECT ...
FROM ...
WHERE Unit in ("NN',"NF")
OR (Unit = "EF" AND Associate = "81")

In the Design View (query grid)
Field: Unit
Criteria (1): In ("NN","NF")
Criteria (2): "EF"

Field: Associate
Criteria (1): << BLANK >>
Criteria (2): 81


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
I

instereo911 via AccessMonster.com

Beautiful - thanks John.

John said:
So you want all records for units NN and NF plus records where Unit EF and
Associate = 81

SELECT ...
FROM ...
WHERE Unit in ("NN',"NF")
OR (Unit = "EF" AND Associate = "81")

In the Design View (query grid)
Field: Unit
Criteria (1): In ("NN","NF")
Criteria (2): "EF"

Field: Associate
good morning,
[quoted text clipped - 15 lines]
thank you everyone again
 

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