tags:

views:

67

answers:

2

I have a huge expression for a textbox in the CONTROL SOURCE. Sometimes it returns 0 and sometimes -1, what do these values mean?

+2  A: 

Read here http://msdn.microsoft.com/en-us/library/aa164500%28office.10%29.aspx

The Boolean data type is a special case of an integer data type. The Boolean data type can contain True or False; internally, VBA stores the value of True as -1, and the value of False as 0

Gaby
+1  A: 

VBA uses 0 for False and -1 for True. (But generally a non-Null, non-zero value will be evaluated as True.) So it looks like your expression is returning a Boolean (True/False) value.

HansUp
who marked this down? this is completely the right answer but gaby answered it correctly first
I__
That answer came in as I was ready to submit mine. I submitted mine because I wanted you to realize a value doesn't have to be -1 to be evaluated as True. I don't mind the down vote.
HansUp