Invalid Use of Null

Dim varTest
varTest = Null
varTest = CLng(varTest)

Running this code produces an error on line 3: "Invalid Use of Null". This is a common error with many VBScript functions that don't like Null values to be passed into them. Take a look at the odd behavior that results from this code:

Dim varTest
Dim lngTest
varTest = Null
lngTest = 2 + varTest
MgsBox(lngTest)

Did you see what happened? When we added the number 2 to the value Null, the result was Null. Once again when you mix invalid data (Null) with valid data (the number 2, in this case), you always end up with invalid data.

First
Next