Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting a Query 2

Status
Not open for further replies.

hsp7777

Programmer
Jan 11, 2005
67
US
Greetings,

I am looking for someone to point me in the right direction as to how to use VBA code to export a query (as an .XLS file). I wasn't sure if I needed to use something in the query defs collection, or if there is a parameter that can be used with the "DoCmd.OpenQuery" command.

At any rate, any information you can give me would be greatly appreciated. So far I've seen no information on how to accomplish this, although I'm sure it's out there somewhere.

Thanks in advance!

 
Hi
I think OutputTo might be what you want:
[tt]DoCmd.OutputTo acOutputQuery, "Query1", acFormatXLS, "C:\OutputFiles\Query1.xls"[/tt]
 
Have a look to the DoCmd.TransferSpreadsheet method too.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks. The "DoCmd.TransferSpreadsheet" solved the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top