Link to home
Start Free TrialLog in
Avatar of rdevriend
rdevriend

asked on

Adding .txt file to a table

In my MS-Access, need to add a lot of data from .txt files into MS-Access tables. Reading the .txt files is done quickly, but appending the data takes ages.

I use following systax :
For i =1 to xxxx
   insert into ...
next

Is itn't possible to accumulate all the data into a kind of internal tables and add in in one INERT INTO statement to the Access table ?

rgds,
rene

Avatar of CRJ2000
CRJ2000
Flag of United States of America image

To help speed things up, you could use BeginTrans and CommitTrans.  This will give you a bit of a speed increase, though perhaps not as much as you're hoping for.

The BeginTrans tells Access to wait until it gets a CommitTrans before it commits the rows.  The CommitTrans, then, saves all of the queued up records at one time.

Unfortunately, it's time consuming to import large amounts of data into Access - it's just not a very fast platform...

Chris
Avatar of speke
speke

If it's a fixed width or delimited text file, use

DoCmd.TransferText

To import all the data into a table then use querys to move it into other tables.
Avatar of rdevriend

ASKER

Sorry for late reply.

BeginTrans and CommitTrand does not work. I am getting all kinds of errors.

I like the uses of DoCmd.TransferText. With this, I want to use the scheme.ini file as import specification.
However, when I create such a file during exporting, I cannot find it anyware on my computer. Where does MS-Access store this file.

rgds,
rene
According to the Access help file (under Import or Link a delimited fixed-width text file, in the Answer Wizard):

Alternatively, you can use a Schema.ini file in a Visual Basic program to provide even more control over data in the text file, such as specifying special currency formats or handling floating point data types. A schema.ini file is a text file containing entries that override default text driver settings in the Windows Registry. You store a schema.ini in the same folder as the imported or exported text file, and it must always be named schema.ini.

Chris
The file is not on my computer, not as schema.ini, not with name I specified myself.

Any idea ?
rene
ASKER CERTIFIED SOLUTION
Avatar of CRJ2000
CRJ2000
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am no longer working on this project, but anyway, you tried to help me. Here are the points