The information in this article applies to:
SYMPTOMSThis code works in Visual Basic 3.0:
but fails in Visual Basic 4.0 and later with a "type mismatch" error.
The correct syntax for this statement is:
Confusing the concatenation operator "&" with the logical operator "AND"
will result in "type mismatch errors."
CAUSEThis is a result of the data type of (Boolean) being added to Visual Basic 4.0 and later. RESOLUTIONWhen performing logical comparisons between operands, be sure to use the logical operators (AND, OR) as opposed to the concatenation operator "&" in Visual Basic 4.0. STATUSThis is by design. MORE INFORMATIONIn Visual Basic 3.0, a logical comparison between operands would result in either a 1 or a 0 being returned. With Visual Basic 4.0 and later, a logical data type has been added so that a logical comparison between two operands will result in either a "TRUE" or "FALSE" value being returned. Attempting to use the concatenation operator "&" can not be performed in Visual Basic 4.0 and later on these logical data types. Therefore, an error is raised. Additional query words: kbVBp kbdsd kbDSupport kbVBA kbVBp400 kbVBp500 kbVBp600
Keywords : kbGrpVB |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |