Boolean in Query

K

Khartoum

I have a query counting the number (sum) of ticks in a column i.e. yes/no
data type. For each column, it is returning the numbers with a minus in front
of it (obviously summing the -1's boolean). Is there a way around it
cheers John
 
J

Jeanette Cunningham

Switch the query to SQL view. Copy what you see in SQL view and paste into a
reply and post back here, so we can see why you are getting numbers with -1.

Jeanette Cunningham
 
A

Allen Browne

Since Access (JET) uses -1 for True (and zero for False), summing a yes/no
field will give the negative of the count of checked boxes.

You can quite easily negate the result. In SQL View (View menu) of your
query, where it says:
SELECT ... Sum(MyYesNo) AS SumOfMyYesNo, ...
change it to:
SELECT ... - Sum(MyYesNo) AS SumOfMyYesNo, ...
 
K

Khartoum

Thanks Allen, simple when you know how - not great user of SQL but this
proves i should be
 

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