& Operator

See AlsoAS5L4DZ              Example0GG10CR>Low

Used to force string concatenation of two operands.


result = operand1 & operand2


Whenever an operand is a number, it is converted to a Variant8PHEAW3 of VarType7A68ZTZ 8 (String).  The data type3GYXY7 of result is String if both operands are String expressions; otherwise, result is a Variant of VarType 8 (String).  If both operands are Null1DDW7C0 (VarType 1), result is also Null.  However, if only one operand is Null, that operand will be treated as a zero-length string when concatenated with the other operand.  Any operand that is Empty1L2JEZ4 (VarType 0) is also treated as a zero-length string.

See Also

Arithmetic OperatorsSH0K1B

Comparison OperatorsNRJZ1K

Concatenation Operators2MYTW1K

Logical Operators1CQVUTN

Operator Precedence23082A9

Other Operators2HA580P

& Operator Example

The example uses the & operator to concatenate a numeric variable (Var1), a string literal containing a space, and a string variable (Var2) that contains "trombones".  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.


Sub Form_Click ()

   Dim Var1, Var2                        ' Declare variables.

   Var1 = 76

   Var2 = "trombones"

   MsgBox 76 & " " & Var2                ' Concatenate and display.

End Sub