Convert date format when importing?

G

Guest

I need to import a comma delimited text file into an existing Access table.
The dates in the text file are in YYYYMMDD format and I want to convert them
to date/time format during the import. Is this possible? I'm doing this via
VBA code, I'm not using the Access menus.

Also, is there any way to edit an existing import spec via the Access menus?
I'm using Access 2000. Thanks.
 
J

John Nurick

I need to import a comma delimited text file into an existing Access table.
The dates in the text file are in YYYYMMDD format and I want to convert them
to date/time format during the import. Is this possible? I'm doing this via
VBA code, I'm not using the Access menus.

Not possible in a single step. The usual way is to temporarily link the
textfile, and then use an append query to move the data into the
existing table, with calculated queries to perform any type conversions
etc. For this date conversion, you'd use something like

sDate: DateSerial(CLng(Left([TheDate], 4)), CLng(Mid([TheDate],
5,2)), CLng(Right([TheDate],2)))
Also, is there any way to edit an existing import spec via the Access menus?
I'm using Access 2000. Thanks.

Start an import using the wizard, and then click the Advanced button to
get at the stored specs.
 

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