Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Importing txt file

1 view
Skip to first unread message

Igor G.

unread,
Dec 9, 2009, 5:31:49 PM12/9/09
to
I have problem with importing txt/csv files with 11 columns data inside.
When is data imported, there is just one column.
Here is my code:
--------------------
Dim strPath As String
Dim strFile As String

strPath = "C:\Tmp\"
strFile = Dir$(strPath & "Alarm.txt")

DoCmd.TransferText acImportDelim, Import, "Alarm", strPath & strFile,
False
--------------------

How enter txt file to access table in 11 columns?
Thanks!

Gina Whipp

unread,
Dec 9, 2009, 7:20:29 PM12/9/09
to
Igor,

It is your Import Specification the sets the text delimiter that separated
the file into fields. What did you set as the delimiter and what is the
delimiter in the file?

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

"Igor G." <Ig...@discussions.microsoft.com> wrote in message
news:0D3ADD59-C8D1-410B...@microsoft.com...

Jerry Whittle

unread,
Dec 9, 2009, 10:21:06 PM12/9/09
to
Please show us an example of the data in the txt/csv file and also what you
want it to look like in the table.

Let's take a look at the acImportDelim argument. Are the fields in the table
delimited by commas, tabs, or something else?

If this is something that you need to do often, you may need to create an
import specification especially if there is a non-standard delimiter such as
the pipe | character. Do a manual import and look for an Advanced button in
the dialog boxes. Figure out things there and save the import spec.

By the looks of your code, Import is the name of your import spec. Is that
true? If so I believe that it needs to be in double quotes to work.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Igor G.

unread,
Dec 10, 2009, 8:13:01 AM12/10/09
to
Here is example, three rows in 11 columns...
Thanks!

ALM 07:49:55 21PC1 PVHI 9.400 HIGH VRH V-4B
T2 9.402 21
ACK 07:50:40 21PC1 PVHI HIGH VRH V-4B
T2 1 31
RTN 07:50:56 21PC1 PVHI 9.400 HIGH VRH V-4B
T2 9.199 21

Jerry Whittle

unread,
Dec 10, 2009, 10:29:03 AM12/10/09
to
That data doesn't seem to be delimited. Try doing a manual import using fixed
width and see if that works. You may need to manually insert the divider
lines between the fields especially near the 1 towards the right side of the
record.

Igor G.

unread,
Dec 10, 2009, 3:09:01 PM12/10/09
to
I was imported txis txt file manual without problems (just, next... next) but
I must create macro for automating this proces with external software.
Here is 11 regular columns. When i was pasted this sample look differently.

Douglas J. Steele

unread,
Dec 10, 2009, 5:19:17 PM12/10/09
to
When you import the data manually, you're given a choice to save the import
specification. Once you've done that, you can specify the specification name
when you're invoking the TransferText method

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Igor G." <Ig...@discussions.microsoft.com> wrote in message

news:F38CBC1D-C839-4692...@microsoft.com...


>I was imported txis txt file manual without problems (just, next... next)
>but
> I must create macro for automating this proces with external software.
> Here is 11 regular columns. When i was pasted this sample look
> differently.
>
> "Jerry Whittle" wrote:
>
>> That data doesn't seem to be delimited. Try doing a manual import using
>> fixed
>> width and see if that works. You may need to manually insert the divider
>> lines between the fields especially near the 1 towards the right side of
>> the
>> record.
>>

0 new messages