Counting no of records in report meeting certain criteria

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?
 
J

John Spencer (MVP)

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
 
G

GaryF

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?
 

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