Count ages in footer

  • Thread starter Thread starter Basenji
  • Start date Start date
B

Basenji

Using Access 2003 in the detail section of a report I am counting the number
of people who are each age, such as age 70, 20 people; age 69, 24 people,
etc. the age range is 23 - 97 in the report. Now in the footer I want to
total the number of people who are <= 25, 25 - 40, 40 - 55 and >=55. I have
tried the following =IIf([Age]<=25,Sum([CountOfAge])," ") but getting an
incorrect total for the number of people who are less than or equal to age
25. I have tried the following for 25 - 40, =IIf([age]>25 And
[age]<=40,Sum([CountofAge])," ") and again getting an incorrect total. What
do you suggest?
 
I think it would be a mistake to hard-code the age values into an expression.
Consider creating a table of age ranges with FromAge, ToAge, and Title. Yo
ucan then create a totals query based on this table and your table with the
age (or DOB). Use this new totals query as the record source of a subreport.
 
The following MIGHT WORK, but you might get an error message also.

=Sum(IIF(Age<=25,CountOfAge,0))





John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top