The use of -1 puzzles me. I would have expected the values to be:
- NO --> 0
- YES --> +1
Is there an historical reason behind the use of -1 instead of +1?
The use of -1 puzzles me. I would have expected the values to be:
Is there an historical reason behind the use of -1 instead of +1?
As discussed on Stack Overflow here, Yes/True values appear in Access as -1 because
Yes/No fields in Access mimic bit fields, Integer values in Access are signed, two's complement values,No/False is represented by 0, and 3-bit:
bits integer
---- -------
000 0
001 1
010 2
011 3
100 -4
101 -3
110 -2
111 -1
2-bit:
bits integer
---- -------
00 0
01 1
10 -2
11 -1
1-bit:
bits integer
---- -------
0 0
1 -1
For the integer representation of a bit field (i.e., 1-bit), if 0 is No/False then the only other value available for Yes/True is -1.
Nullvalues. As I thought the reason for it being -1 is because of the type of integer data type a boolean is defined as. "This is because the Boolean data type is stored as a 16-bit signed integer." The actual binary value of -1 is1111111111111111. This question has been asked several times on SO http://stackoverflow.com/questions/8827447/why-is-yes-a-value-of-1-in-ms-access-database – Ramhound Dec 30 '13 at 17:1411111111 11111111would not result in00000000 00000000. The logical bitwise NOT ofFalseshould beTrueand vice versa. – Ramhound Dec 30 '13 at 17:21Yes/Nofields in Access cannot beNull, onlyYes/TrueorNo/False. If you try to force aYes/Nofield toNullit simply becomesNo/False. – Gord Thompson Feb 02 '14 at 13:24