count of records that meet criteria from two fields

R

robertm600635

What I need to do is create a query that first finds all records that meet
certain criteria from two different fields then count those records.
We have multiple facilities and programs, so I need to know how many people
are in a certain facility [field1] and a certain program [field2] then count
those.
 
M

Michel Walsh

either


DCOUNT( "*", "tableName", "field1='cafeteria' AND field2='eating' ")


either


DCOUNT("*", "tableName", "field1='cafeteria' OR field2='eating' ")


the first one giving the number of records where both conditions occur, the
second expression, where at least one of them occur.


You can use the syntax FORMS!formName!ControlName to refer to a value in a
control:

DCOUNT( "*", "tableName", "field1=FORMS!myForm!whichFacility AND
field2=FORMS!myForm!whichProgram ")




Hoping it may help,
Vanderghast, Access MVP
 
Top