Conditional Summing

K

Keith

I have a form that I use in Datasheet view as a subform. The form has
several calculated fields in it's footer using the sum command.

This works fine, but what I need to do is only sum the records where a
certain field is set to true.

How can I do this?
 
K

Keith

Svetlana said:
Use DCount function for it.

DCOUNT only counts the number of records. The field I am summing on is numeric. If only two records meet the true validation then Dcount would return 2, but I want a total. The field I am summing on might equal 3 in the first record and 6 in the second so the value I want returned is 9
 
D

Dirk Goldgar

Keith said:
I have a form that I use in Datasheet view as a subform. The form has
several calculated fields in it's footer using the sum command.

This works fine, but what I need to do is only sum the records where a
certain field is set to true.

How can I do this?

You could use a controlsource expression (in the form footer) like

=Sum(IIf([BooleanField]<>0, [AmountField], 0))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top