Avatar of FaithDan
FaithDan
 asked on

Convert number yyyymmdd to Date/time mm/dd/yyyy MS Access 2003

Microsoft Access 2003
 I have a table with a number field [Brth_DT] with dates setup as yyyymmdd.  This field is setup with the data type Number.

I am making a make- table Query to convert this number field to a date field in the new table.  I need the new field to be a date field with mm/dd/yyyy.

What expression do I need to use to get this to work in the Query Design View?

Microsoft AccessDatabases

Avatar of undefined
Last Comment
rockiroads

8/22/2022 - Mon
JestersGrind

Try this:

CInt(Left([Brth_DT], 2)), CInt(Mid([Brth_DT], 3, 2))), DateSerial(CInt(Right([Brth_DT], 4))

Greg


FaithDan

ASKER
I tried that it says invalid syntax or quotes.  Any Ideas?
ASKER CERTIFIED SOLUTION
rockiroads

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rockiroads

If u want it displayed as mm/dd/yyyy you could try changing the format property on the table design.
subsequently doing format("mydatefield","Short Date") will take the format that is defined in your control panel settings
but you can override by doing format("mydatefield","MM/DD/YYYY")
note, only to be done on a date field, not your yyyymmdd field
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
FaithDan

ASKER
Thanks Rockiroads... it worked perfeclty
rockiroads

No probs. Glad to have helped, again!!! :)