Sum data under special condition

S

SF

Hi,

I have a main and detail subform. In the subform I had a Check field (Yes/No
field) from the under laying table. I am having a problem of putting a
sum(amount) on the main form for only item that has a check in the Yes/No
filed.


Could someone advice?

I have Access 2003 on XP box.

SF
 
B

Baz

A Yes/No field has a numeric value of zero when it is "No", and -1 when it
is "Yes". So, to achieve what you want, simply multiply the amount by the
Yes/No field, and by -1 e.g.

Sum(amount * yesnofield * -1)
 
Top