Puts the minus value in sum

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I'm trying to count or sum the field called "RESULTS" depending on the value
(e.g. PASS, FAIL, N/A). I've used the "count" function and it did not work.
I now use the "sum" function and it returns the correct value but puts the
minus in front of the value (e.g. -17, -30 etc.,). Thank you for your help.

Control Source
=Sum(qryTestsOut.RESULTS="PASS")

returns value -20
 
You are probably using Yes/No fields that store data as a zero for No or
False and minus one for Yes or True. When you sum your Yeses it will be a
minus number.

Change to =Int(Sum(qryTestsOut.RESULTS="PASS"))
 
Make one change to your control source.

=Abs(Sum(qryTestsOut.RESULTS="PASS"))

You are summing the result of the boolean test - Results ="Pass". In Access,
that returns 0 for false and -1 for True. So adding the Abs (Absolute) function
strips off the negative sign.
 
Back
Top