View Single Post
  #2  
Old November 21st, 2005, 06:25 PM posted to microsoft.public.access.reports
external usenet poster
 
Posts: n/a
Default Count of Report values in Report Footer

Mark A wrote:
I need to create a count at the end of my report that tells me how many
occurances of a certain value appear in the report.
e.g. Report field of "Issue". Possible values of "Red" or "Amber". Need to
count how many times red and amber occurs.
I guess, something like "COUNT(Issue) where Issue = "Red")" is needed.
e.g. 2 (more complex)
e.g. Report field of "Name". I do not want to "hard code" the possible
values that can appear in the report for Name but I need to count how many
times each name appears in the report.
I have played around with SUM and COUNT and tried the Running Sum function
but to no avail.



For a quick and dirty approach, you can use expressions like
this:
=Sum(IIf(Issue = "red", 1, 0))

But, you're right, you do not want to use hard coded values
most of the time. A more general approach is to create a
Totals type query that retrieves the desired data and
calculates the counts for each name or issue. Then use the
query as the record source for a subreport.

--
Marsh
MVP [MS Access]