Selectively Filtering a CSV File Import ?

The Brown Growler

Registered User.
Local time
Today, 13:58
Joined
May 24, 2008
Messages
85
Hi,

Is it possible to selectively filter the records in a csv file when importing into an access table, ie, only specific records from the csv file are imported ?

I have a large number of csv files each with a large number of records and most of the data is not required. There is one specific field in the csv file that contains a value that could be used as a filter. Could a filter be set up to only get those records from the csv file where this specific field has a certain value ?

I have checked out the "Import Specifications" options for importing csv files but there is no option to selectively filter which records are imported.

I was hoping to use a macro to import all of the csv files to the same table, however, access stops the import with the "Invalid Argument" message box when the database size gets to 2 gigabyte.

Any help most appreciated.

Thx & Rgds
Growlos
 
You could link to the csv file from your access app, then build a query to update a database table with the fields you want under the criteria you need. If you have a unique field then you can index this without allowing duplicates and it will prevent reloading data already existing.
 
Fifty2One,

Thx for the input, i had not thought of linking to the file, however, that could offer a solution.


Rgds
Growlos
 
Another method would be to open the file using the Open File For Input syntax then read each line and decide as to whether you wanted it or not.If wanted you can then use the Open File For Output to create a new file containing only those records you want to import. Then use this as your base file for importing. Once imported this can be deleted.

David
 
DCrake,

Thank you for the reply and interesting advice.

I have not used the "Open File For Input/Output" before. Does it need to be run by code or is it a menu option somewhere ? I have checked out the main menus but cannot locate it. Is it buried in a sub menu somewhere ?

Also, when you say "read" is this a manual read of the data or an electronic read, I have 250 csv files each containing over 1.5 million records so I need some type of electronic option.


Thx & Rgds
Growlos
 

Users who are viewing this thread

Back
Top Bottom