Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selective Import

Status
Not open for further replies.

DanAuber

IS-IT--Management
Apr 28, 2000
255
FR
I'm importing data from a flat-file - There are several million records in the file - but I only want to import those where the first field is '2001' - is there anyway to do this using the import/transfer text routine ?

I know I could bring all the records in and then delete the one's I don't need - but this leads to database size issues.

Any help gratefully recieved

thanks

Dan

 

Link the file once and use an apropriate append query. If the file name changes, then write some code that finds and renames the file, overwritting the previous version of it!
 
Several million records?
Wow!

Of course you could write some VBA code that will scan through the file and "import" only wanted records.
That however depends on your file structure.

Google for "FileSystemObject" object, "OpenAsTextStream" and "ReadLine" methods.
Then wrap the read lines into a Recordset-Update block loop.

Hope this helps!

MiS

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top