Kevin Zubrus said:
No particular reason, I'd just like to know why yes = "-1"
and not "1"
It's arbitrary behavior defined by the Jet Database Engine and by VBA.
Boolean (yes/no, true/false) values are minimally represented by one
bit, 0 for false, 1 for true. Boolean values in Jet and VBA are both
stored internally as 2-byte integers. In the format used for
representing a two-byte integer, a value of 0 is stored, in binary, as
0000000000000000; a value of -1 is stored as 1111111111111111. As you
can see, these values are about as opposite as they can get -- I think
that was the basis of the decision made by the developers and language
designers.
It may help to realize that, in VBA, a conditional expression is
actually evaluated on the basis of zero/nonzero. So although the
constant True is equal to -1, logic like this works:
Dim intVariable As Integer
intVariable = 1234
If intVariable Then
Msgbox "Hey! That's true!"
End If
Note these results, though:
intVariable = 1234
If intVariable = True Then
Msgbox "You'd think that might be true ..."
Else
Msgbox "... but you find that it isn't."
End If
That's because 1234 doesn't *equal* the constant True, though it is
*logically* true.