Import but not append each time!

  • Thread starter Thread starter Koulla
  • Start date Start date
K

Koulla

I have a table Stud that I import from a Stud.txt file.
Every week Stud.txt file will be change. I have a macro
that import Stud file but every time I import it to access
it append Stud.txt file to Stud access table. The macro
contains TransferText. In TransferText Type I have Import
Delimited. Can I do the import but to not append the file
each time?? By macro or by other way?

Thanks a lot!
Koulla
 
If you need to keep the table structure for "Stud" intact, then I would suggest that you create a delete query against that table. A delete query will only delete the records in the "Stud" table, leaving the table structure intact

Next, in your macro, Insert a row above your import commands, and select the "OpenQuery" action. Enter your query name where indicated, and save the macro

Now, when you run your macro, it will clear out all the records in the "Stud" table, before it imports your new records
Your other option is to do a DeleteObject action on the "Stud" table, deleteing the table entirely, then modifying your import macro to import to a new table each time.

Hope this help
Rosco
 
If you don't want to append, you just want to overwrite, you will need to
delete all the data in the Stud table before importing using TransferText.

If you want to still use a macro, you would add a new Action prior to your
TransferText, ie,

1st Action: RunSQL, SQL Statement: DELETE * FROM STUD;
2nd Action: TransferText, yada yada
 
Try running a delete query first on the entire table before executing the transferdatabase macro.
 
Back
Top