PDA

View Full Version : TransferText for huge-sized text file



fixo
08-17-2006, 02:13 AM
I have a text file with half-million rows in following form:
1, 1, 28.6745389500, -91.5227403500,27,72, 1939248.750000, 2913.140000,19980422,19970424,Y
I used TransferText method example Help with all of possible
variations of options, but have no luck this way:think:
Instead of table with 11 columns I have a got it with one column only
Where is my mistake?

Sub DoImport()
Dim MyPath As String, MyName As String, MyTable As String
MyTable = "PipeLines"
MyName = Application.CurrentProject.path & "\" & "COPYTXT.txt"
DoCmd.TransferText acLinkDelimited, "", MyTable, MyName, False, ""
End Sub

Thanks in advance
Fatty
~'J'~

stanl
08-17-2006, 02:47 AM
Just guessing, but one possibility is that your text file does not have a header row and you have not indicated a specification or schema.ini entry.
Stan

fixo
08-17-2006, 03:00 AM
Just guessing, but one possibility is that your text file does not have a header row and you have not indicated a specification or schema.ini entry.
Stan

Hi, Stan
Thank you for a quick reply
Yes, you are right, this is my first attempt to
import text, can you show me an example what I must
to doing further?

Fatty

~'J'~

OBP
08-17-2006, 03:30 AM
First of all you need to do the "Import" manually and during the import click "Advanced" to specify how the text should be imported, i.e. what type of file delimited or fixed width, setting column widths etc.
When you are happy with this save the "Specification" and then use that spefication in your VBA import statement like this one.
DoCmd.TransferText acImportFixed, "test", "No Moves", "c:\Access\Nicks Database\No Move.txt"
In this case the "test" is the specification for a fixed width text file.

fixo
08-17-2006, 03:47 AM
First of all you need to do the "Import" manually and during the import click "Advanced" to specify how the text should be imported, i.e. what type of file delimited or fixed width, setting column widths etc.
When you are happy with this save the "Specification" and then use that spefication in your VBA import statement like this one.
DoCmd.TransferText acImportFixed, "test", "No Moves", "c:\Access\Nicks Database\No Move.txt"
In this case the "test" is the specification for a fixed width text file.

Thanks for reply,
I did this earlier, but haven't success, maybe problem is on
the big size of text file (~ 47,6 Mb)
There is do not allows to me to import this file manually too
In error message I have got something like this:
decimal part delimiter the same as text delimiter
(Sorry for my poor english)

Fatty

~'J'~

OBP
08-17-2006, 04:12 AM
Fatty, your English is pretty good.
Can you open the text file using "Word" or "Wordpad"?
If you can copy about 20-50 lines of the data and the paste it in to a new document.
You can then post the new (small) document on here as an attachment for us to look at to see if we can see what is going wrong.
To post it as an attachment you have to click the "Go Advanced" button under where you reply and then go down the page to "Manage Attachments", browse to your file, double click and then click the "Upload" button.

fixo
08-17-2006, 04:31 AM
Fatty, your English is pretty good.
Can you open the text file using "Word" or "Wordpad"?
If you can copy about 20-50 lines of the data and the paste it in to a new document.
You can then post the new (small) document on here as an attachment for us to look at to see if we can see what is going wrong.
To post it as an attachment you have to click the "Go Advanced" button under where you reply and then go down the page to "Manage Attachments", browse to your file, double click and then click the "Upload" button.

Thanks a lot to all for the help!

The problem is solved
The case was on that the delimiter 'dot' is displayed
in the table as 'comma', I have replaced a delimiter in a text file
on 'semicolon' and now the same code, that I used,
has given me desired result

On the other hand, the size of file Access is more 86 Mbytes, but
it's already other history

Many regards, Stan and OBP:friends: :beerchug:

Fatty

~'J'~