Importing text file with append

R

Roxana

Hi,
I am trying to import a text file into an Access table. I am using this code:
DoCmd.TransferText acImportDelim, , "tbl-Download", "C:\Download.csv", True
This code uploads the data into a table but I would like that next time I
run this code (button) data gets appended to the table. Is there a way I can
upload the data and append it to the table , all in one step ?
Would I have to do it in 2 steps /buttons one for TransferText into a temp
table and then an append query?

Thank you
Roxana
 
M

Maurice

I've used the way you described several times and that's what gets the job
done.
So place a button and behind the on_click event place you code to import the
data into a table called tmpDownload. But before you do that you have to
empty the tmpDownload table first to get rid of all the old stuff. After that
you can run the append query which will add the unique records assuming you
have a key defined.

So all in all here are the steps:

1. delete the tmpDownload first ("Delete * From tmpDownload")
2. Run your import code here
3. Run the appendquery here

You can put off any warnings if you'd like.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top