Just when I thought I understood...
I am comparing the reservationdate and the checkindate (done the same way
as
what you showed below). I add 5 months to the reservationdate and then do
a
compare against the checkindate. If the checkindate is any month other
than
9, the compare is working fine but when the checkindate month is 9, it is
comparing higher than the reservationdate +5 months
Reservation Date Reservation Date + 5 Checkindate Result
9/17/2007 2/17/2008 10/5/2007
low
9/17/2007 2/17/2008 9/26/2007
high
It should show a low comparison against the Reservation Date + 5 months.
Any idea why it is showing incorrectly?
:
DateSerial(YearPart,MonthPart,DayPart)
ie
RESERVATIONDATE: DateSerial(Left([Res Dateyy],2),Mid([Res
Dateyy],3,2),Right([Res Dateyy],2)
HTH
Pieter
Obviously, I am not following the DateSerial command.
I have a date that is stored on the table in text. It's format is
ymmdd.
I
have made it yymmdd. Then I tried to
RESERVATION DATE: Format(DateSerial(Right([Res Dateyy],2),Mid([Res
Dateyy],3,2),Left([Res Dateyy],2))) and it does not format correctly.
I
have
played with the positions and I can't seem to figure out the
correlations.
Help.
:
Safer is
DateSerial(Left([CustomerDOB],2), Mid([CustomerDOB],3,2),
Right([CustomerDOB],2))
As you don't have to worry about the regional settings
Pieter
If you've inherited a database that has dates in a text field, with
a
format
like 990102 for Jan-2-1999, you need to convert those to regular
Access
date
fields.
Add a new blank DATE field to your table to store your new value. My
old
date is in the text field CustomerDOB, so I'll add a new one called
NewCustomerDOB.
Now I'll create an UPDATE QUERY using the LEFT, RIGHT, and MID
functions
to
put the date together:
Update to: Right([CustomerDOB],2) & "/" & Mid([CustomerDOB],3,2) &
"/"
&
Left([CustomerDOB],2)
Be sure to back up your database before running any update queries
as
there
is always the possibility of data loss!
I actually have a video tutorial on my web site that shows how to do
this:
<a
href="
http://599cd.com/tips/access/AC309-convert-numbers-to-dates.asp?key=MSForum">Microsoft
Access Convert Numbers To Dates</a>
http://599cd.com/tips/access/AC309-convert-numbers-to-dates.asp
Hope this helps.
Richard