first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Protecting Type Conversion Functions From Null Values

To avoid Run-time Error 94 (Invalid Use of Null) when using type conversion functions, "protect" them by concatenating "default" values where logically possible. Suppose that g_varReturn is a variant. We can use type conversion functions on g_varReturn with the forms:

<variable of type Double> = CDbl(0 & g_varReturn)

<variable of type String> = CStr(g_varReturn & "")

<variable of type String> = CStr(g_varReturn & Empty)

Note that in the CDbl() example above the zero is concatenated in front of g_varReturn. Do not concatenate the zero after g_varReturn!

mod date: 1998-06-30T17:12:05.000Z