Automate a Import Process/Maybe just a Refresh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Smith
    New Member
    • Dec 2010
    • 72

    #1

    Automate a Import Process/Maybe just a Refresh

    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 TransferSpreads heet exel TableA
    Open the macro to TransferSpreads heet exel TableB
    Open the macro to TransferSpreads heet exel TableC
    Open the macro to TransferSpreads heet exel TableD

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

    Run append query to Master_Append_q ty 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
  • Lysander
    Recognized Expert Contributor
    • Apr 2007
    • 344

    #2
    You could put a button on your form, and use the On_click event to write VBA code something like this.

    Code:
    db.Execute ("DROP TABLE Table1;"), dbFailOnError
    db.Execute ("DROP TABLE Table2;"), dbFailOnError
    'etc for all tables
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "Table1", "C:\Myspreadsheet1", True
    
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel7, "Table2", "C:\Myspreadsheet2", True
    
    etc

    Comment

    Working...