Importing csv file

  • Thread starter Thread starter Gerrym
  • Start date Start date
G

Gerrym

I want to import a CSV file using a Macro and transferText
I can created a specification file but can I specify which
line to start the import from.
 
No.

Import the entire file into a temporary table, and then use an append query
to copy just the desired data to the permanent table.
 
Then how do I Clear a table from within the macro, I would
like to do this before I import

Tks
 
Run a delete query from the macro. Create and save a query that will delete
the records from that tale. Run that query via OpenQuery action. If you
don't want to see the "warning" message about "you're about to delete...",
put a SetWarnings action (argument set to No) before the OpenQuery action
(and then put one with argument set to Yes after the OpenQuey action if you
want the messages back on while the rest of the macro runs).
 
Thanks again Ken

Just one more question, for now anyway. As well as
deleting all records before importing I then need to run
another delete query to delete the 16 records in the
imported table, can you tell me what to put in the
criteria of the second delete query to only delete 16
records.

Tks again
 
Delete which 16 records? If you can identify those records by some
criterion, then your delete query just needs to include a WHERE clause to
identify those records. Post more info about what is in those records, and
we'll give some help.
 
Hi,

Hmm.. 16 records?

I think we need to know more about the csv file you're importing. Is it
cumulative? In a sense that every time you import the csv file, the csv file
contains data that you had already imported previously?

If so, can you determine uniqueness of each record in the csv file? For
example, let's say a combination of 3 fields makes each record in your csv
file unique. Then, in your destination table in Access, define those 3
fields as a primary key. With this setup, the append query will not append
records that are already in your table.


HTH,
Immanuel Sibero
 
Back
Top