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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
conditional count in report
Hi,
How do I put a conditional counter at the footer in a report? For example, I got a list of students in a report and I want to know how many male and female in total. Thanks. |
#2
|
|||
|
|||
conditional count in report
On Mon, 6 Nov 2006 09:27:38 +0800, "00KobeBrian" wrote:
Hi, How do I put a conditional counter at the footer in a report? For example, I got a list of students in a report and I want to know how many male and female in total. Thanks. Base the Report on a Query with two calculated fields; IsMale: IIF([Sex] = "M", 1, 0) IsFemale: IIF([Sex] = "F", 1, 0) In the report Footer put textboxes Summing these numeric values. John W. Vinson[MVP] |
#3
|
|||
|
|||
conditional count in report
Is there a way I can directly put the works on the report instead of the
query? Thanks. "John Vinson" wrote in message ... On Mon, 6 Nov 2006 09:27:38 +0800, "00KobeBrian" wrote: Hi, How do I put a conditional counter at the footer in a report? For example, I got a list of students in a report and I want to know how many male and female in total. Thanks. Base the Report on a Query with two calculated fields; IsMale: IIF([Sex] = "M", 1, 0) IsFemale: IIF([Sex] = "F", 1, 0) In the report Footer put textboxes Summing these numeric values. John W. Vinson[MVP] |
#4
|
|||
|
|||
conditional count in report
Add a control in the report footer.
Set its source to =Abs(Sum(Sex="Male")) For female =Abs(Sum(Sex="Female")) That assumes that you have a text field named Sex and that it contains the values Male or Female. 00KobeBrian wrote: Hi, How do I put a conditional counter at the footer in a report? For example, I got a list of students in a report and I want to know how many male and female in total. Thanks. |
#5
|
|||
|
|||
conditional count in report
It works perfectly. Thanks.
"John Spencer" wrote in message ... Add a control in the report footer. Set its source to =Abs(Sum(Sex="Male")) For female =Abs(Sum(Sex="Female")) That assumes that you have a text field named Sex and that it contains the values Male or Female. 00KobeBrian wrote: Hi, How do I put a conditional counter at the footer in a report? For example, I got a list of students in a report and I want to know how many male and female in total. Thanks. |
#6
|
|||
|
|||
conditional count in report
By the way, how come the absolute value function works on this?
"John Spencer" wrote in message ... Add a control in the report footer. Set its source to =Abs(Sum(Sex="Male")) For female =Abs(Sum(Sex="Female")) That assumes that you have a text field named Sex and that it contains the values Male or Female. 00KobeBrian wrote: Hi, How do I put a conditional counter at the footer in a report? For example, I got a list of students in a report and I want to know how many male and female in total. Thanks. |
#7
|
|||
|
|||
conditional count in report
On Mon, 6 Nov 2006 10:41:48 +0800, "00KobeBrian" wrote:
Is there a way I can directly put the works on the report instead of the query? Thanks. My friend John Spencer's answer solves this and simplifies the problem anyway - go with it! btw, the Abs() is because the value of True is -1. If you just add the logical expressions you'll get -12 if there are 12 girls. John W. Vinson[MVP] |
#8
|
|||
|
|||
conditional count in report
"00KobeBrian" wrote
By the way, how come the absolute value function works on this? Because, behind the scenes, Access uses -1 for True and 0 for False (and you are having Access do the calculation). So, if there are any Trues, you'll sum them and they will result in a negative number equivalent to the positive number of Trues. Then the Abs function converts the negative number to a positive number. Larry Linson Microsoft Access MVP |
Thread Tools | |
Display Modes | |
|
|