Convert String to Date

C

Chris

I have been given a table with "visit_date" stored as text as follows:

29MAY2009
19JUN2009
06FEB2009
06MAR2009
06FEB2009

I need to convert data to a date field in a query.

Thanks.

Christine
 
J

John Spencer

Try

DateValue(Format("29MAY2009","@@ @@@ @@@@"))
Or
CDate(Format("29MAY2009","@@ @@@ @@@@"))

To keep errors at bay you might try

IIF(ISDate(Format([Visit_Date],"@@ @@@ @@@@"))
,CDate(Format([Visit_Date],"@@ @@@ @@@@")),Null)

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top