Query

M

Michael

When i run a query based on a table with a yes/no field i
want to find everyone with a yes why do i have to type -1
instead of 1???

Thanks in advance

Michael
 
J

Jeff Boyce

Michael

MS Access stores a True in a Boolean field as a value of -1. Other backends
use 1, or ...

The one common feature is that False is 0. You could make your code/query
more generic by testing for <>0.

Good luck

Jeff Boyce
<Access MVP>
 
J

John Vinson

ok thats fair enough but why -1 why not 1????!!!

Most computers store negative numbers in "one's complement" notation -
for example, if the size of the number is 16 bits, 0 is stored as
0000000000000000, 1 as 0000000000000001. Negative numbers are stored
by flipping - "complementing" - each bit and adding 1, simply because
the original computer arithmatic hardware worked better that way. -1
is stored as 1111111111111111.

With the convention that 0 is FALSE and any nonzero set of bits is
TRUE, it makes sense to use the value with all bits set as TRUE; and
this just happens to correspond to -1 numerically.
 

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