Re: How to import .csv file to a table?

From: Allan Christopher <allan477_at_yahoo.com>
Date: 11 Mar 2004 02:21:58 -0800
Message-ID: <a0ff70d9.0403110221.19981500_at_posting.google.com>


"gexin" <gexin.chen_at_ncr.com> wrote in message news:<404f01bc_at_rpc1284.daytonoh.ncr.com>...
> I have experience to import below kinds of text file into a table, but how
> can I import .csv file in table?
>
> Thanks

Since I'm reading this in the Access group I'll give my access answer. I have used 3 different methods and am still using the 3rd.

DoCmd.TransferText didn't work for me mainly because of a comment field that occasionally had a comma in the comments. It wasn't just the comma, there was a date field too that wouldnt load right sometimes. Transfer text was too easily confused even when setting text qualifiers or using import specs.

For a while I used Chuck Grimsby's clsReadTextFile with good luck. This worked because the comment field was surrounded by quotes. I would search for commas between the qoutes and replace them with pipes. I could then parse the commas and process the line. Then, change the pipes back to commmas after the import (Fortunately never experienced a single qoute typed in the comment field!).

Now I Dim a New Excel.Application and open the .csv as an Excel.Workbook and have been very happy with the results.

Allan Christopher Received on Thu Mar 11 2004 - 11:21:58 CET

Original text of this message