Importing .TXT file into Access 2010

Strikertom

New member
Local time
Today, 07:09
Joined
Jan 17, 2014
Messages
9
Hi people,

I am having difficulty importing a large txt file into my database, due to the first column containing a * prefix. normally i would just go through the document and delete it, but this file is quite large at over 100k records.

Is there anyway of importing this file in access 2010 and telling access to ignore the first column?

Thanks in Advance.
Tom
 
Well you can (re) write the file quite easily
Code:
    Dim myLine As String
    Open "file" For Input As #1
    Open "filetemp" For Output As #2
    Line Input #1, myLine
    Do While Not EOF(1)
        Write #2, myLine
        Line Input #1, myLine
    Loop
    Close #1
    Close #2
Or even go manual import on this using above or simular... Just need to tweak the reading and writing, etc.

On the other hand if you want to skip the entire column you can define that quite easily in the ImportSpecification which you can create when you manually import any text file. Just click the "Advanced" button during the (manual) import of the file and "fix" your import spec :)
 
yes

when you create an import spec (by importing manually from the external data tab) you are prompted for the delimiter, whether the file contains headings etc. To the botton left you will see the advanced button. Click on this to open the form below and in the field information section you can click on skip to prevent the field from being imported. If the failure is due to the field being interpreted as numeric and then failing when an * is found, you can also modify here to import as text, then use a query to do the necesary corrections once imported
attachment.php

Recommend you then save the spec (same form) with a recogniseable name for use in transfertext
 

Attachments

  • ScreenHunter_11 Apr. 04 09.27.jpg
    ScreenHunter_11 Apr. 04 09.27.jpg
    50.2 KB · Views: 228
Thanks for the info guys, I will try those methods, for now I have imported the file into excel 2010, then deleted the first column with the * field, then saved that as a txt document and imported that, and that seemed to work.

Thanks again.
Tom
 

Users who are viewing this thread

Back
Top Bottom