Counting no of records in report meeting certain criteria

  • Thread starter Thread starter GaryF
  • Start date Start date
G

GaryF

How do I set the control source in a report to count only the number of
records in the report where "x" field is "1" or some other designated amount?
 
Use an expression like one of the following as the control source

=Abs(Sum([x]=1))

X=1 will return True (-1) or False (0)
Summing those values will return a negative number representing the number of
trues. Abs will strip off the negative sign.

or

=Count(IIF([X]=1,1,Null))

Count counts the existence of any value that is not null

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Thanks a lot. You solved my problem.

John Spencer (MVP) said:
Use an expression like one of the following as the control source

=Abs(Sum([x]=1))

X=1 will return True (-1) or False (0)
Summing those values will return a negative number representing the number of
trues. Abs will strip off the negative sign.

or

=Count(IIF([X]=1,1,Null))

Count counts the existence of any value that is not null

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
How do I set the control source in a report to count only the number of
records in the report where "x" field is "1" or some other designated amount?
 
Back
Top