Import last n records from a text file

kriemer

Registered User.
Local time
Yesterday, 22:44
Joined
Aug 28, 2005
Messages
38
I am importing a large number of large text files (>10,000) into a single table. This part works fine but I am finding that VB is painfully slow (approx 2 hours) for this kind of thing.

What I would like to be able to do is to is to limit the import to the last n records in each file (hopefully speeding up the import process).

Any suggestions?

Thanks to all in advance.

k
 
Try linking to the text file and running an append query to get the data into a table. It will be faster than VBA.

Otherwise, you'll need to write a VBA procedure that counts all the records in the file. Closes it, then goes back to the beginning and reads n records to get to the first record it wants to import. This will be pretty slow also. Importing the FIRST n records will be much faster since there is no read ahead to count required. You just read and insert until you reach your count.
 

Users who are viewing this thread

Back
Top Bottom