ACCESS IMPORT DATE/TIME IN CSV FILE

G

Guest

I'm importing a CSV file into ACCESS, but the date/time field (format:
9/26/2005 22:00) won't import as a date/time, only text. Any suggestions?
It imports fine into EXCEL as a date/time field, but the files I want to use
are over 700,000 rows long.
 
G

Guest

Inport the all the CSV data into a 'working' table. Put that date data into a
text field. Create a query with all the fields in the working table and
surround the date field with the CDate function. Use this query as the basis
of an append query to the final resting place for the data.

One problem with CDate is that it will bomb if any of the data can not be
evaluated as a proper date. Therefore I suggest first checking the data using
the IsDate function. It will tell you if any of the 'dates' can't be
converted to a date.

IIf(IsDate([YourTextDate]) = True, CDate([YourTextDate]), #1/1/1950#)

In the example above if the date can be evaluated as a date, it is converted
to a date. If not the bogus date of 1 January 1950 is inserted instead. You
could then search for these bogus dates (or any other valid date value that
you chose) and fix them manually.
 
J

John Vinson

I'm importing a CSV file into ACCESS, but the date/time field (format:
9/26/2005 22:00) won't import as a date/time, only text. Any suggestions?
It imports fine into EXCEL as a date/time field, but the files I want to use
are over 700,000 rows long.

Odd! How are you doing the import? With a text-file wizard?

Try *linking* to the file, and running an Append query into a pre-made
table with your date/time field predefined. It should convert
correctly.

John W. Vinson[MVP]
 

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