Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count criteria in a column on an Access Report 1

Status
Not open for further replies.

littleboots

Technical User
Nov 5, 2002
13
GB
I am new to MS Access and I'm having a problem summarising data in one of my reports. The data I have is linked to a Flight Information query which gives Surname, First Name Title etc and the Sex then Class eg Business, First or Economy

I have managed to count the number of passengers using the =count(*) tool in a text box, but I need to total the number of Male passengers and the number of Female passengers from the [Sex] column (I also then need to apply this to the [Class] column - I presume in the same way).
How do I count the number of 'M's and 'F's in the [Sex] column?
 
In the ControlSource for you textboxs put these expressions.
=Sum(IIf([Sex]="M",1,0))
=Sum(IIf([Sex]="F",1,0))

This will give you a count of each sex. Summing 1 and 0's is the same as counting. Put these textboxes in the Class Footer.

Paul
 
Thanks PaulBricker for your help - I applied those expressions to my Report and it works fine! I couldn't find any examples of this in the Microsoft Help pages - so thank you.
 
Does anyone know how to sum if you want it to meet 2 different criteria in two feilds.

For instance:=Sum(IIf([Fee]="STD",1,0)) AND Sum(IIf([Expenses]="NON STD",1,0))

this code does not work, but how could I make this work?
 
This is probably a little late Ronnie but this is what you would use.

=Sum(IIf([Fee] = "STD" And [Expenses] = "NON STD",1,0))

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top