Count on 2 fields

gschimek

Registered User.
Local time
Today, 01:52
Joined
Oct 2, 2006
Messages
102
I have a report that counts up records in a text box on the report footer. For example, I count up the number of males listed in the report by using this code as the controlsource of the text box:
Code:
="Male = " & Count(IIf([Gender]="M",0))
I want to be able to count the number of people that match a particular gender, and also match another field. For example, all Males that wear a Large T-Shirt.

I've tried code like this:
Code:
="Males - L = " & Count(IIf('[ShirtSize]="L" & [Gender] = "M"',0))
but that didn't work. I think it's counting all records that aren't null in either of those fields, because the count comes up as the same as the number of records in the report.

Anybody know how I can accomplish this?
 
I've never done it in a report but in a query I would use a Sum
eg Sum(IIf([ShirtSize]="L" and [Gender] = "M",1,0))

Brian
 
Perfect! Thanks.
 

Users who are viewing this thread

Back
Top Bottom