Convert date to serial number

  • Thread starter Thread starter Ha
  • Start date Start date
H

Ha

I am trying to convert a date into a serial number.
I used DateValue(3/13/1997) in the textbox. I am getting
#Name? error

Help please,

-Ha
 
Ha said:
I am trying to convert a date into a serial number.
I used DateValue(3/13/1997) in the textbox. I am getting
#Name? error

The DateValue function expects either a string or a date
e.g.

DateValue("3/13/1997")
or
DateValue(#3/13/1997#)

What you wrote is the date value of 3 divided by 13 divided
by 1997 which would end up as 12/40/1899. But that won't
explain a #Name? error, so either you didn't post what
you're really using, the error is coming from something
else, or you have a referencing problem that made the
DateValue function unavailable.
 
Hello Marsh,

I tried DateValue(#3/13/1997#). Result still show #Name?
Under the textbox property I left formating empty.
Decimal Places is Auto.
I am not referencing to any table? What could it be?
 
Ha said:
I tried DateValue(#3/13/1997#). Result still show #Name?
Under the textbox property I left formating empty.
Decimal Places is Auto.


Ah ha!now it sounds like you have the expression in a text
box. If so, don't forget that control source expressions
must be preceeded by an = sign:

=DateValue(#3/13/1997#)
 
I tried your suggestion. This time the result shows
3/13/1997. It did not convert to a serial number like I
wanted.
 
Ha said:
I tried your suggestion. This time the result shows
3/13/1997. It did not convert to a serial number like I
wanted.


Serial Number? What serial number? I thought you knew how
to do that and only needed to get the the date part
straightned out.

Whatever. DateValue is not going to any more than return
a date. If you want some kind of number, you'll have to
explain what it's composed of and the data you have
available to construct it.
 
Back
Top