Count ages in footer

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

Duane Hookom

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

John Spencer

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
 

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