Best way to export a table into Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hibbii
    New Member
    • Oct 2006
    • 23

    Best way to export a table into Excel

    I want to create a button on a form that will automatically export the contents of a make table query into Excel. This query however is based on a combo box that selects the fiscal quarter for which the data should represent.

    I was wondering what the best way to do this was and also have some way that Excel would show the quarter number that is being represented. Access reports can just link to the combo box but what about in Excel?

    Any and all help would be truly appreciated.

    TIA
  • Tanis
    New Member
    • Mar 2006
    • 143

    #2
    If you use the transfer spreadsheet method to output your data [query or table] you can have each output saved to a different worksheet as long as you output to the same file name. The sheet name will be based on the name of your query.


    Code:
    DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9, "FiscalPeriod1" , "PathNameToExce l:\MyFile.xls", True
    DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9, "FiscalPeriod2" , "PathNameToExce l\MyFile.xls", True

    You can define your criteria in the queries. If the users need to change [select] the criteria then you will have to embed the process in a form where the users can make [adjust] their criteria and the queries feed off of the forms selections.

    Comment

    Working...