• Export query to excel with subtotal

    Author
    Topic
    #458125

    I am current use the following codes to export a query to excel file:

    DoCmd.TransferSpreadsheet acExport,acSpreadsheetTypeExcel97, “qry_Master”, “c:Master.xls”, True

    There’s a field in qry_Master call “status.’ Now I want to have a subtotal of “Yes” and “No” of status field when I export query to excel.

    What needs to be modified in this code to achieve what I’m after?

    Thanks,

    Viewing 1 reply thread
    Author
    Replies
    • #1150823

      One option would be
      – Create a totals query that groups by the status fields and calculates the subtotals.
      – Create a union query that combines your original query and the totals query.
      – Export the union query.

      Another:
      – Use Automation to open the exported workbook in Excel from Access, and add the subtotals there.

    • #1150824

      Thnaks, Hans.

    Viewing 1 reply thread
    Reply To: Export query to excel with subtotal

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: