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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting 4 queries to 1 speadsheet

Status
Not open for further replies.

rwttm001

IS-IT--Management
Nov 20, 2002
26
GB
I'm trying to output the contents of 4 queries into one spreadsheet. At the moment I have to do this 4 times into 4 different sheets, which is impractical. I would like like the spreadsheet to have 4 worksheets/tabs, 1 for each query. The code I'm using is:

DoCmd.OutputTo acOutputQuery, qry1, acFormatXLS, filename1 etc..

Thanx
Matt
 
What you need to do is create a 5th query which is a UNION of the first four....take a look at the Query Wizard -> UNION query. Then you export this UNION query instead of your four individual ones... ****************************
Only two things are infinite, the
universe and human stupidity, and
I'm not sure about the former.
(Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: robert.l.johnson.iii@citigroup.com
h: wildmage@tampabay.rr.com
 
Thanks for that but the 4 queries come from different tables that I would like to put into the same speadsheet in 4 different tabs. A union query would just put all the data into 1 set of results.

 
You could try the TransferSpreadsheet method instead which enables you to give a range. Be aware though, TransferSpreadsheet somehow puts ' characters in textfields which may not be what you want.

Bye,
Jeroen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top