Results 1 to 8 of 8
  1. #1
    RLG is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    4

    Importing .txt file with >255 columns into Access

    Hi Guys,

    Can anyone tell me how to get a large .txt file into Access. I know it has too many columns so I selected about 30 columns that I don't need to be 'skipped'. However it is just giving me the error that my file has more than 255 columns - with the 30 selected for skip - it should have about 230 columns.
    Any ideas?
    Thanks
    RLG



  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Options:

    1. edit the text file to remove the unneeded data (maybe use Excel) then use import wizard

    2. use VBA code to open the text file as an object and manipulate the object - read in one line at a time, parse the string to an array, loop the array, save what you want
    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
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    error that my file has more than 255 columns
    In addition to what June said, this is an Access limit. A table cannot have more than 255 fields. Apparently, Access sees the total number of columns (fields) before the columns are skipped and won't allow the import.

  4. #4
    RLG is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    4
    Unfortunately I can't do that - too big for XL and can't do it in the .txt - 1.3G file with probably 1.5m+ rows.
    It's dumb to have Access read the number of columns and then not be able to see that it won't import them all.
    Oh well
    thanks for suggestions guys.
    RLG

    I might be able to copy it in SQL and delete the columns there I suppose?

  5. #5
    RLG is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    4
    Mind you that may be beyond my SQL because it is a table made from a bunch of other linked tables to collect all the relevant info. So.. I'd need to find everything I want and nothing I don't want and there are lots of calculations involved to gather the information. hmm I think I may be stuck.
    RLG

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    June's second option may be the best option:
    2. use VBA code to open the text file as an object and manipulate the object - read in one line at a time, parse the string to an array, loop the array, save what you want
    This is not an uncommon method used to import text files into Access for a myriad of reasons, when the normal manual Import or TransferText just won't do.

  7. #7
    RLG is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2014
    Posts
    4
    OK. Thanks all appreciate the help.
    RLG

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    That file is not too large to parse with vba, I've processed 4.5gb files without any issue, just takes a while to run (in my case it was about 30 minutes). You may also be able to use powershell if this is a fairly common occurrence and have it run on the server instead of a workstation. You've already stated you can identify the columns you want and the columns you don't, as long as there is an identifiable delimiter that is 100% reliable you can load each line into an array then build a SQL statement around the elements of the array you want and append those to your target table.

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

Similar Threads

  1. Importing Excel file to access
    By bambereczek in forum Access
    Replies: 1
    Last Post: 09-10-2012, 06:38 AM
  2. Importing Txt file to Access
    By fuxy in forum Access
    Replies: 6
    Last Post: 04-25-2011, 07:58 AM
  3. Importing a text file to access
    By Navop in forum Access
    Replies: 2
    Last Post: 11-11-2010, 07:15 PM
  4. Replies: 1
    Last Post: 07-31-2010, 08:04 AM
  5. Importing file into Access
    By jquickuk in forum Import/Export Data
    Replies: 1
    Last Post: 03-23-2009, 09:18 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