interesting result

gdanalakshmi

Registered User.
Local time
Today, 04:32
Joined
Nov 26, 2002
Messages
102
I have a field that is of type yes/no.

My SQL view of the query is as follows:

SELECT Count(QryRptMac.VioceMAC_ID) AS CountOfVioceMAC_ID, Sum(QryRptMac.Handset_New) AS SumOfHandset_New
FROM QryRptMac
HAVING (((Sum(QryRptMac.Handset_New))=True));

My result is

FirstColumn SecondColumn

34 -12


Sum result of the second column is -12. Why is it a negative result instead of 12
 
For a Yes/No field, True is internally stored as -1, whereas False is stored as 0. So the sum is negative. You can use the Abs() function to remove the negative sign:-

Abs(Sum(QryRptMac.Handset_New)) AS SumOfHandset_New


But why do you want to sum a Yes/No field?
 
Basically, True is a non-zero entity. Access represents this as -1, so when you add them, you get a negative result.

Good question, Jon
 
Actually it is checkbox that the user checks if applicable. I am assigned to create a report with a count of selected checkboxs.
 
But you are counting VioceMAC_ID and summing Handset_New ...
 

Users who are viewing this thread

Back
Top Bottom