Setting Null to date

  • Thread starter Thread starter Oded Kovach
  • Start date Start date
O

Oded Kovach

Hello there

I have function that set date on date variable that return it by the
function

If no date should be set and i leave the date return value as it was on the
function the function returns 00:00:00 (leagel date on access and not on sql
server)

How can i return null value if no date should be returned?
 
What's the function?

In order to return a Null, the function must return a Variant, not a Date,
type.
 
A Date _Variable_ in VBA cannot be Null, though a Date _Field_ in a
Recordset may contain a Null value. If you want a VBA function which
handles dates/times to be able to return Null, its return value has to
be Dimmed as Variant, _not_ as Date. Alternatively (and I think this
is often better) you can code your VBA to explicitly use and test for
#00:00:00# as a "virtual" Null value - it is almost never going to
turn up as a real date, though you need to remember that it may quite
properly turn up as a real time (midnight).

Hello there

I have function that set date on date variable that return it by the
function

If no date should be set and i leave the date return value as it was on the
function the function returns 00:00:00 (leagel date on access and not on sql
server)

How can i return null value if no date should be returned?


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top