I am importing an excel file into Access 2010 and the date field(CALLDATE) comes in as text(YYYYMMDD). I would like to use an update query to update a new field "dateofcall" but using a date/time format. I tried to use:
UPDATE tbl_Import SET tbl_Import.dateofcall = CDate([tbl_Import].[CALLDATE]);
I thought it was going to be that simple but it shows up blank with a date format. I also tried to use DateSerriel() but still was getting errors. Any suggestions?
You can use left, right and mid string functions to construct a date from the various parts of the string.
For example:
DateSerial(Left(MyTextDate,4),Mid(MyTextDate,5,2),Right(MytextDate,2))
You can use the above in an Update query to update a date type coulmn 9field) to a the date from the text column.
My date came in as text looking like this:"2013-03-23 00:00:00.0"
I take the left 10 characters only, "2013-03-23", this makes it so Access can recognize it is a date field and then I just switch around the format.
Format(Left([WEEKEND],10),"m/d/yyyy")