Visual Basic Variable DIM as Date

C

Chris

I need to reset a Date Variable to NUll or no date.

Dim Nodate as Date

NoDate = ""

This code errors and I need to set the variable to null so
I can set a field in a table to nodate.

Any Ideas?

Thanks is advance
 
R

Rick Brandt

Chris said:
I need to reset a Date Variable to NUll or no date.

Dim Nodate as Date

NoDate = ""

This code errors and I need to set the variable to null so
I can set a field in a table to nodate.

Only a variable of type Variant can contain a Null value.
 
L

Larry Linson

A Date is actually, behind the scenes, stored as a double precision floating
point, with the integer part representing days since Dec. 30, 1899 and the
fractional part representing time, so even a date value of 0 represents a
date... 12:00 AM Dec. 30, 1899. If your actual date range is appropriate,
that could represent "no date" for you.

Oh, yes, lest someone ask... the "days since" portion can be negative to
represent time and date prior to Dec. 30, 1899. As to why they chose _that_
particular date as the zero point, you'd have to ask someone in Redmond, WA,
USA, not me.

Larry Linson
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top