import text file with criteria

  • Thread starter Thread starter GEORGIA
  • Start date Start date
G

GEORGIA

Hi,
I have a text file with over 200,000 records. I do not want to import all
the records, I only want to import records with coll_ID = 456.

How would I go about doing so? Currently I import everything then deletes
anything other than that ID #.

Thanks!
 
There are a couple of ways to do this depending on the type of text file. If
it is a csv file, you could link to it as a table and use a filtered append
query to append the records to your table.

If that wont work for you, you could import the entire file into a temporary
table then use an append query to populate the production table.
 
it's a txt extension file. I don't want to link the file because the file is
replaced daily by someone else. How would I got about importing into temp
file without causing the size of database to increase? I was hoping where in
the import spec or vba code to filter it out?

Thanks!
 
You can't do it with VBA or import specs.
It is not a problem to link to a table that changes daily. All you need to
do is
Link to the file
Run the query to append the data to the Access table
Use the DeleteObject method to drop the link.

This is actually the best way when it comes to preventing bloat. Only the
imported data is added to your database.
 
Back
Top