As far as I know, the only variable type that can be set to NULL is Variant. All the others Date, String, Integer, have default values that are set upon declaration and can only be overwritten by other valid values, but not NULL.
A work around that I used when interacting between a VB front end and an Access database was to declare my variable intended for the date as a variant. Then I checked the user input. If it was empty then, I would assign NULL to my variable. If a value was entered, I would use the IsDate() function to establish that the entry was a correct date format.
At this point, I passed the entry to the database where it would be sorted properly.
Whether or not you can use this depends on what your program is and how you intend using the dates entered.
Do post if you find a better way. I was never that enamoured with my own way of doing this.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.