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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count up on a Report 1

Status
Not open for further replies.

l3reacher

Technical User
Jun 28, 2003
83
US
I have a table name table1 and a field that is formatted to 2 options, which is Yes and No. My question is how do I count up all of the Yes and all of the No's seperate on a Report?? Thanks!!

I Hate Spammers and Flammers!!!
 
To count Yes's use
Sum(IIf([FieldName] = -1,1,0))

To count No's use
Sum(IIf(FieldName] = 0,1,0))

Paul
 
What if I have an option between Apple and Orange when the field name is for example: FieldName, is there anything in that code I need to change??

I Hate Spammers and Flammers!!!
 
You just change the other side of the expression to reflect Apples and Oranges instead of Yes and No.
Like this.
Sum(IIf([FieldName] = "Apples",1,0))


Paul
 
Thank you very much!!

I Hate Spammers and Flammers!!!
 
Right now i tried the codes you gave me, and the Yes/No count works, but I tried
Sum(IIf([FieldName] = "Apples",1,0))
and it didn't work.

I do have the fieldname "Fieldname", and under that field is a drop down list of Apples and Orange.

When I try to view the report, it gave me a message:
This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to varioables.

I Hate Spammers and Flammers!!!
 
Ok I found the problem!! Thanks

I Hate Spammers and Flammers!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top