How do I define a Null string, date or integer in VBA?
I need to be able to assign a Null value to some fields for certain records when data is incomplete or irrelev
Dim x As Variant
x = Null
Only the Variant data type can hold the value Null
.
A Variant is a special data type that can contain any kind of data [...] A Variant can also contain the special values Empty, Error, Nothing, and Null.
The "point" of all the other data types is precisely that they cannot contain any ol' kind of data. This has two advantages that I can think of:
Of course, Variants do have their place, as other threads on this site discuss.