Automate a Import Process/Maybe just a Refresh

TBC

Registered User.
Local time
Yesterday, 16:20
Joined
Dec 6, 2010
Messages
145

I’d like to try and automate a import process. Below are the steps I currently use to get these excel spread sheets into my ms access database.

Manual delete tables Table1, Table2, Table3, Table4.
Open the macro to TransferSpreadsheet exel TableA
Open the macro to TransferSpreadsheet exel TableB
Open the macro to TransferSpreadsheet exel TableC
Open the macro to TransferSpreadsheet exel TableD

“All these tables have the same type of data, and field names”

Run append query to Master_Append_qty for all 4 Tables.

Is there a way I can just do a refresh. All

Can I get some advice or help automating this process

Thanks for all your help and time
TCB

 
Stepping outside of the macro world (been years since I really used them) -

Code:
Function RunMyImports()
   ' deletes the data first
CurrentDb.Execute "Delete * From TableA", dbFailOnError
CurrentDb.Execute "Delete * From TableB", dbFailOnError
CurrentDb.Execute "Delete * From TableC", dbFailOnError
CurrentDb.Execute "Delete * From TableD", dbFailOnError
 
DoCmd.TransferSpreadsheet ....etc.
DoCmd.TransferSpreadsheet ....etc.
DoCmd.TransferSpreadsheet ....etc.
DoCmd.TransferSpreadsheet ....etc.
 
End Function

Put that in a standard module and then call it from a click of a button by using:
Code:
Private Sub MyButtonNameHere_Click()
   RunMyImports
End Sub
 

Users who are viewing this thread

Back
Top Bottom