Results 1 to 5 of 5
  1. #1
    phagan is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    2

    Help importing data from .csv to multiple tables!


    I am trying to create a button or a simple form for a few research assistants to quickly import survey data (.csv) into an Access DB.

    I’ve figured out how to import the csv file as far as a table, but I need to then copy the data into multiple (like…25) tables throughout the database.

    So far all I can think of would be to create 25 separate append queries for each destination table and then set up a macro to run all of them onclick. Is that even possible?

    I’m completely in over my head here, any tips?



    Thanks a lot

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why duplicating data?

    Yes, would require multiple INSERT sql actions
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101

    Help importing data from .csv to multiple tables!

    Hi June7,

    Can you describe more on this?
    I had the same issue to solve last night. All I did was create 3 append queries to populate my 3 tables in the correct order from my text file import!!

    If there is another easier way to do this I am all ears?

    Thanks

  4. #4
    phagan is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    2
    Thanks for the help!

    I definitely want to avoid duplicating data, if possible. It was my understanding that I could only import a csv file into one "dummy" table, then I would have to insert them into their original tables from there. Is that true?

    What would multiple insert functions look like? Could running so many functions at once cause database issues?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I don't routinely do csv imports, just somewhat familiar with the process. The import wizard does allow an Append option for text file import. Whether or not the import will go 'cleanly' depends on the source file.

    Code can programmatically accomplish imports and/or SQL actions. You would do 25 imports or 1 import to temp table and then 25 INSERT SELECT sql actions. Again, why duplicating data?

    The SQL actions can be saved Access objects and then code (macro or VBA) can execute them from button Click event. I use only VBA so I would probably code the sql action entirely in VBA. Would include line like:

    CurrentDb.Execute "INSERT INTO tablename SELECT ..."
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-07-2011, 01:56 PM
  2. Compare Data in Multiple Tables
    By Access_newbie in forum Queries
    Replies: 7
    Last Post: 07-26-2011, 11:35 AM
  3. Importing Excel datasheets into multiple tables
    By FishMT in forum Import/Export Data
    Replies: 3
    Last Post: 02-08-2011, 07:44 AM
  4. Importing data into various tables
    By simba in forum Import/Export Data
    Replies: 1
    Last Post: 01-13-2011, 12:42 PM
  5. Importing and mapping data to various tables
    By rasticle in forum Import/Export Data
    Replies: 1
    Last Post: 05-17-2010, 04:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums