Solved

Export Access query to defined Excel spreadsheet

Posted on 2008-10-11
2
1,048 Views
Last Modified: 2012-05-05
Hello,

I have a query that I would like to export to a specific sheet within an Excel workbook. Is this possible? Below is my macro code
Function mac_excel_patient_export()
On Error GoTo mac_excel_patient_export_Err
 
    DoCmd.TransferSpreadsheet acExport, 10, "qry_excel_patient", "c:\test\data.xls", True, ""
 
 
mac_excel_patient_export_Exit:
    Exit Function
 
mac_excel_patient_export_Err:
    MsgBox Error$
    Resume mac_excel_patient_export_Exit
 
End Function

Open in new window

0
Comment
Question by:Dozingquinn
2 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 400 total points
ID: 22695677

  DoCmd.TransferSpreadsheet acExport, 10, "qry_excel_patient", "c:\test\data.xls", True,"SheetName"
 
0
 

Author Closing Comment

by:Dozingquinn
ID: 31505373
Thanks for your skills
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question