Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ho to transfer csv file stored in c:\temp\csv.txt into a table L0966 in c:\applicazioni\contabilita.mdb???

    note:
    the csv file have headerrova01,prova02,prova03 is separated from ";"
    the filelds in table arerova01,prova02,prova03

    with ado please

    i just have a coon opened

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    You have a number of options to consider in transfering a text file into a database table. One option is to simply link to the text file - the version of Access you are using may have some impact on how well that works. If you need it to be an Access table, then you could simply run an append query once you have linked to the table.

    Another option would be to use the TransferText capability in VBA to reach out the the file and import it into an Access table which already exists. That may be the most straightforward approach.

    It you really want to use ADO, which is the most difficult and doesn't buy you anything, you would have to either link to the table as in the first option, and then loop through each of the records, writing the corresponding record out using ADO, or you could do a READ from a text file, and parse each record, and then use ADO to build the table record by record.

    My approach to all things database is to use the simplest technique - unless I'm doing something as a learning exercise, which I usually try to avoid, sometimes unsuccessfully.
    Wendell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •