Importing Date string and changing form

G

GAAPMan

I am importing a CSV file that has a date field in the following format:
20050625. I need to convert this string to 06252005. What is the best way to
do this when I import the file?

Thanks
 
J

John Vinson

I am importing a CSV file that has a date field in the following format:
20050625. I need to convert this string to 06252005. What is the best way to
do this when I import the file?

Thanks

Two possible answers:

If you want to import to a Text field containing a String (which you,
but not Access, may interpret as a date) use

Mid([CSVDate], 5) & Left([CSVDate, 4)

If you prefer, you can import it to a Date/Time field which can be
displayed with a mmddyyyy format (or any other format you wish) with

DateSerial(Left([CSVDate], 4), Mid([CSVDate], 5, 2), Right([CSVDate],
2))

John W. Vinson[MVP]
 
Top