Results 1 to 3 of 3
  1. #1
    DWilkins is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2013
    Posts
    1

    Importing Data From Text File Containing Multiple rows into one row of a table


    I receive .txt files daily that I need to import into a table. Each text file contains multiple rows which need to be combined into one row of each table. I am new to this feature and can not seem to figure this out. Example of data:

    10|A|B|C|D|E|F|
    20|A|B|C|D|E|F|
    21|A|B|C|D|E|F|
    23|A|B|C|D|E|F|
    25|A|B|C|D|E|F|
    10|A|B|C|D|E|F|
    20|A|B|C|D|E|F|
    21|A|B|C|D|E|F|
    23|A|B|C|D|E|F|
    25|A|B|C|D|E|F|
    Each text file contains starting row records (10, 20, 21, 23, and 25) which all relate to the same "account", where the information follows in each row (A,B,C,D,E,F) Every time a row identifier "10" appears, this tells me where a new "account" begins, which needs to start a new row. The problem is there could be anywhere from 1 through 100 seperate "accounts (record 10) in each text file. I am not sure how to import a file liek this. Thank you in advance for your assistance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    This will require VBA code that opens the text file as an object, reads each line, parses data, and saves to record. Rather common topic. Search forum or web.

    Here's a couple:
    https://www.accessforums.net/program...ion-23820.html
    https://www.accessforums.net/import-...ile-25269.html
    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
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    You can also import teh text file into a termporary table and allow Access to add an autokey field, such that the VBA process runs down the imported table rather than the text file. It's basically the same VBA code, though.

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

Similar Threads

  1. Replies: 2
    Last Post: 01-30-2013, 06:48 AM
  2. Replies: 5
    Last Post: 12-03-2012, 05:03 PM
  3. Replies: 5
    Last Post: 12-01-2011, 05:38 PM
  4. Importing text file into Access Table
    By Anthony in forum Import/Export Data
    Replies: 13
    Last Post: 09-23-2009, 04:47 PM

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