View Full Version : Converting Numbers to Date


Grey King
03-24-2002, 08:56 AM
Situation: I have in a table of records with three number fields for storing a date (year, month, day). I have a query where I want to return records between a certain dates, but how do I convert the three number fields in to a single date field so I can use a query like this

SELECT records FROM table
WHERE recorddate BETWEEN startdate AND enddate

Thanks ahead of time!

Rich
03-24-2002, 11:24 AM
Why three fields?

Grey King
03-24-2002, 12:47 PM
I didn't have a choice in it... it was the way the application had been built before I got there. It also has to do with the data it imports...

Trust me, when I say if I had a choice I would have used a date field and saved myself the headache... =)

RV
03-24-2002, 01:05 PM
I guess you can use the DataSerial function.
Look in the Access helpfile for "DateSerial".

HTH,

RV

Bushido121
04-03-2002, 10:21 AM
Try this

SELECT CDate([Dates]![Month] & "/" & [Dates]![Day] & "/" & [Dates]![Year]) AS [Date] FROM Dates
WHERE (((CDate([Dates]![Month] & "/" & [Dates]![Day] & "/" & [Dates]![Year]))>#1/1/2000#));

Concatnate the Month, Day, Year together with a slash in between, THEN use the cDate function to convert it to a date.

Jerid