Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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,

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='garyfei' post='764234' date='08-Mar-2009 23:07'][/quote]
    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.

  3. #3
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thnaks, Hans.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •