Date check

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

Guest

I am running into problems while doing a date check.
Can someone help me please?

I have defined a variable of type date

GDate as date

I get error for GDATE = NULL.

When I want to assign a date value, I entered
DateValue('1/1/1880'), for some reason, its storing
12:00AM.

How can I address this and how can I assign a format to
it?

Thank you,
-Me
 
datevalue is dependant on your OS date format which can get problematic if
you export your code best use dateserial(yyyy,mm,dd)
ie
Dateserial(1880,1,1)
use format to bring it back as text
ie Format(gdate,"DD/MM/YY")

stephen
 
Stephen,

Thank you, I think what you have suggested should work.
However, I am running into other problem of initializing
variables. Like if I give GDate = NULL or GNumber = NULL,
I get errors. How can I initialize them?

Thank you,
-Me
 
If you have dimmed GDate as a Date type then it cannot hold a null value. If
you need it to hold either a date or a null, then your only choice is to dim the
variable as a variant.

Second, I would think that you need
DateValue("1/1/1880")
or
DateValue(#1/1/1880#)
 
Back
Top