I am using Access 2010. I have a form with two buttons, btnHigh and btnLow. If the user clicks btnHigh, the font is made bold, and the other button is set to not bold.
btnHigh.FontBold = True
btnLow.FontBold = False
Then in my code I use this line:
If btnHigh.FontBold = True Then
...
I was surprised to discover that if this button is Bold, btnHigh.FontBold = 1
And since True = -1, even though the font is bold, the test fails because 1 is not equal to -1.
This works:
If btnHigh.FontBold = Abs(True) Then
But that seems an odd way to have to proceed.
Is this commonly known? Are there other cases in VBA where a test of "truthiness" yields 1 instead of -1?
btnHigh.FontBold = True
btnLow.FontBold = False
Then in my code I use this line:
If btnHigh.FontBold = True Then
...
I was surprised to discover that if this button is Bold, btnHigh.FontBold = 1
And since True = -1, even though the font is bold, the test fails because 1 is not equal to -1.
This works:
If btnHigh.FontBold = Abs(True) Then
But that seems an odd way to have to proceed.
Is this commonly known? Are there other cases in VBA where a test of "truthiness" yields 1 instead of -1?