Overwrite data on Import of Transferspreadsheet

G

Guest

Thanks to all the nice people that helped me out earlier.
I need to refresh an Access table from an external Excel file everyday,
Using a macro to do this would require me to use the "Transferspreadsheet"
function. But this function adds data into the existing table, creating
doubles. Is there a way to overwrite existing data on a table instead of
adding data into it during "transferspreadsheet"? Any automated import
function that would clear away yesterday's table and create a new one would
also work..if it can be done.
 
K

Ken Snell [MVP]

Before you do the TransferSpreadsheet action, run a delete query that
deletes all the current records from the table where you want to put the
data from the TransferSpreadsheet action.
 
G

Guest

Thanks for the quick help. Your input has solved the problem.
For others who would want to do this, I'd advise creating 3 separate macros
for this task;
1. Runquery = where a delete query is initiated
2. Transferspreadsheet = where the deleted data is replenished
3. Macro to run 1 and 2.
(The 3 macros was necessary bec it wouldnt function right if the first 2
actions are combined in one macro).


Ken Snell said:
Before you do the TransferSpreadsheet action, run a delete query that
deletes all the current records from the table where you want to put the
data from the TransferSpreadsheet action.
 

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