set a date field to null

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have Dim InitialHSDate as Date, and do various calcs as I loop thru a
table. At each new record I want to set InitialHSDate to null and start the
calcs again fresh.

I tried InitialHSDate = "NULL" (= null)(= "") but none work.
Thanks,
Doug
 
Doug said:
I have Dim InitialHSDate as Date, and do various calcs as I loop thru
a table. At each new record I want to set InitialHSDate to null and
start the calcs again fresh.

I tried InitialHSDate = "NULL" (= null)(= "") but none work.
Thanks,
Doug

The ONLY variable type that can be set to Null is Variant. The default or
"fresh" value for a date is 12/30/1899 00:00:00 which is represented numerically
under the covers as zero. So just set InitialHSDate to zero instead of Null.
 
I have Dim InitialHSDate as Date, and do various calcs as I loop thru a
table. At each new record I want to set InitialHSDate to null and start the
calcs again fresh.

I tried InitialHSDate = "NULL" (= null)(= "") but none work.
Thanks,
Doug

A Date datatype variable cannot be NULL. Dim the field as a Variant instead,
and just set it to

= Null

with no quotes.

John W. Vinson [MVP]
 
Thanks John and Rick.

John W. Vinson said:
A Date datatype variable cannot be NULL. Dim the field as a Variant instead,
and just set it to

= Null

with no quotes.

John W. Vinson [MVP]
 
Back
Top