Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    6

    Unanswered: importing csv into existing table

    hi, i need some advise on how to get started to create a script on how to automatically importing csv file from specified path into existing table in my db.
    Please help me on this.

    Table name is "tablogs"
    path: "c:\3dif\csv files"
    file name: "Smdr(backup1-1-2009)"

    I also having problem how to set up the SPECIFICATION. What is this?
    Please share some of your ideas.

    I really appreciate your help.
    Thanks.
    Je

  2. #2
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    First do a search in Access' help on "Import Specification". This will explain how to create one. After you create the specification, you should be able to use code to import your file. Something like:

    Code:
    docmd.TransferText acImportDelim, "Name of your specification", "tablogs", "c:\3dif\csv files\Smdr(backup1-1-2009)"
    There are some other arguments for the TransferText method so make sure you look in the Help files for more information.

    Hope that helps.

    C

  3. #3
    Join Date
    Feb 2009
    Location
    Atlanta, GA
    Posts
    1
    Hi Je,

    First take note of the tablogs table structure as you will need it when setting up the specs or specification aspect of your transferdata code in vb.

    Click the text file button on the import tab or if using older versions go through the motions to import a table and select the .txt or .csv filetype. this shoould open the Import text wizard.

    Choose whether delimited or fixed width is appropriate depending on how the data is set up in the .csv file.

    On that same view of the dialog, you will see the advanced button. Click it and select the same file format you selected earlier and in the field information section, set up the structure of the table you are importing. this way, everytime you import data into the table you already set up, it will organize the .csv data in this format.

    Once done with the field information setup, click save as and give it a name (e.g. tablogsdata or anything you like) and close. Continue with the import wizard promts and import the data. If everything works well, it should populate your table with the data. Once this is done, you can delete the data and apply the spec name to your script in this case "tablogsdata".

    Hope this helps

Posting Permissions

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