report totals

  • Thread starter Thread starter cc
  • Start date Start date
C

cc

In a Report Footer, I would like to sum the totals from two fields. The
fields are check boxes. I have added a Text Box to the Report. In
Properties for the field, I would like to be able to go to Control Source and
put in an expression that would work. To get the sum of one field with a
check box, I use the expression:
=sum(IIf([field name],1,0)) and it works fine.
But, I cannot come up with an expression that would add together the sums of
two fields that are check boxes. Can you help?
P.S. Please keep it simple if you can. My Access knowledge is limited.
Thank you very much for your assistance!
 
cc said:
In a Report Footer, I would like to sum the totals from two fields. The
fields are check boxes. I have added a Text Box to the Report. In
Properties for the field, I would like to be able to go to Control Source and
put in an expression that would work. To get the sum of one field with a
check box, I use the expression:
=sum(IIf([field name],1,0)) and it works fine.
But, I cannot come up with an expression that would add together the sums of
two fields that are check boxes.


You can not sum check box controls, so I will assume that
you want to count the number of true values in two Yes/No
fields in the report's record source table/query.

=Sum(IIf([field name a],1,0)) + Sum(IIf([field name b],1,0))
 
Thank you for your response. I had already tried the expression you
suggested, but it does not work. Any other ideas?



Marshall Barton said:
cc said:
In a Report Footer, I would like to sum the totals from two fields. The
fields are check boxes. I have added a Text Box to the Report. In
Properties for the field, I would like to be able to go to Control Source and
put in an expression that would work. To get the sum of one field with a
check box, I use the expression:
=sum(IIf([field name],1,0)) and it works fine.
But, I cannot come up with an expression that would add together the sums of
two fields that are check boxes.


You can not sum check box controls, so I will assume that
you want to count the number of true values in two Yes/No
fields in the report's record source table/query.

=Sum(IIf([field name a],1,0)) + Sum(IIf([field name b],1,0))
 
cc said:
Thank you for your response. I had already tried the expression you
suggested, but it does not work. Any other ideas?


In what way did it not work?

It might help me understand what you are trying to do if you
would post some sample data and the result you want from
that data.
 
Sorry! It did work on the fields that were yes/no boxes. I mistakenly used
the same expression on fields that were numbers, not yes/no boxes. Not
thinking clearly. Thank you.
 
Back
Top