469,579 Members | 1,198 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

DoCmd.TransferText to import text from a large text file

Hi. I'm new to this board and have a few questions about using the
method referred to in the topic of this message.

I have manually transferred over 1/2 million records from a text file
into my Access table in under 1 minute, using File>Get External
Data>Import, then specifying .txt as the data source, selecting
the text file, and walking through the resulting Wizard.

I'm thinking I can do the same thing with DoCmd.TransferText, but
don't understand all the parameters. The basic format is:

DoCmd.TransferText (TransferType, SpecificationName, TableName,
FileName, HasFieldNames, HTMLTableName, CodePage)

Here's what I have so far:

DoCmd.TransferText(acImportDelim,, "MyTable", "Path to text file"). I
don't think I need any of the last parameters. When I exit this line
in my VB6 app, however, I get the error message, "Compile error.
Expected =".

I think the key is including the SpecificationName, which I don't
understand. Any ideas? If SpecificationName is a path to some file
with import specifications, could someone also please explain the
format of this file and include an example?

My table has three fields, all text type, the first field indexed, no
primary key (don't need one). My text file contains comma delimited
rows such as:

Row1Field1Value, Row1Field2Value, Row1Field3Value
Row2Field1Value, Row2Field2Value, Row2Field3Value

Like I said, this imports in less than a minute manually in Access,
and I'm thinking will do the same from with my VB app.

Thanks ahead for help.

Nov 13 '05 #1
3 12311
Do a manual import (Get external data / import), change the file type
to txt and click on Import. When the import text wizard opens, click
on Advanced. That's where you can define your import specification.

Nov 13 '05 #2
Hm, when working with Access 2003, I've seen this error pop up from
time to time. I've responded to it by removing parenthesis from
procedure calls (i.e. calls that don't return a value). So, try this

DoCmd.TransferText acImportDelim,, "MyTable", "Path to text file"

Nov 13 '05 #3
yeah no shit.. i think that is a bug in access also.

removing paranthesis shouldn't be necessary but these drunk monkeys in
redmond are too lazy to fix BUGS.

I have a laundry list of a dozen bugs in Access and Microsoft won't

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.