Consulting

Results 1 to 3 of 3

Thread: Export Access Query Results to Excel and open the workbook

  1. #1
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    141
    Location

    Export Access Query Results to Excel and open the workbook

    Good morning

    A button on my database runs a query and saves the results to an Excel workbook. Does anyone know how to alter this code to automatically open the workbook after it is saved please?

    DoCmd.OpenQuery "qryData", acViewNormal, acEdit
    DoCmd.OutputTo acOutputQuery, "qryData", acFormatXLSX
    Thank you

    Mykal

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,289
    Location
    Workbooks.Open FileName:=(Path & docName)
    Where Path is the path to the folder and dconame is the name of the excel document.

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,961
    Location
    More of an Access question but the answer is simple.
    'https://docs.microsoft.com/en-us/office/vba/api/access.docmd.outputto
    DoCmd.OutputTo acOutputQuery, "qryData", acFormatXLSX, , True

Tags for this Thread

Posting Permissions

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