A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Count ages in footer



 
 
Thread Tools Display Modes
  #1  
Old August 24th, 2009, 02:54 PM posted to microsoft.public.access.reports
Basenji
external usenet poster
 
Posts: 61
Default Count ages in footer

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?
  #2  
Old August 24th, 2009, 03:56 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Count ages in footer

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.

--
Duane Hookom
Microsoft Access MVP


"Basenji" wrote:

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?

  #3  
Old August 24th, 2009, 04:16 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default Count ages in footer

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

Basenji wrote:
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?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.