If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: How to make a date Variable empty ?

I realize I'm writing this 11 years after the initial query, but the advice given is erroneous, and so I'm adding this so others who see this page are not misled. vbNull is intended strictly for use with the VarType() function to test if a variable is Null, as follows:

If VarType(abc) = vbNull Then

You cannot use vbNull to set a variable to Null. Indeed, if you try it, like so:

abc = vbNull

then the variable will actually be assigned a value of 1 (or "1" if it's a string variable). So if you do that then obviously an IsNull() test would fail to work properly because the variable is not null.

My understanding is that for a code variable you can't actually assign a Null to it unless it's a Variant data type (unlike an Access table field, which you can assign as Null). So a string variable must be assigned as empty string and a numeric must be assigned zero (or whatever else you want to used to signify as "unassigned" in the logical context of your code), like so:

Re: How to make a date Variable empty ?

Reply to Your Query - Solved
If you declare any variable as date format, it will the data like as "00:00:00".
So before execute your sql command , please verify the contents in the date varaible as follws
If isdate(Var_date) = True or Var_date <> "00:00:00" Then
Tablename!Fieldname = Var_Date
else
TableName!FieldName =Empty
End if

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.