Solved

export multiple queries to 1 excel spreadsheet

Posted on 2004-09-28
5
926 Views
Last Modified: 2008-03-03
I have 5 queries which i need to export into 1 excel spreadsheet. each query will have its own tab in excel.

class anyone?

don't know where to get started. queries are are already built.

all help is appreciated.
0
Comment
Question by:lallentx
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
pique_tech earned 250 total points
ID: 12174956
Repeated use of DoCmd.TransferSpreadsheet to the same Excel destination file will add each query on a tab with the same name as the query.

i.e.,
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Product", "c:\test.xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ProductCategory", "c:\test.xls", True
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ProductGroup", "c:\test.xls", True

produced a spreadsheet at c:\ called test.xls with three tabs, one called Product, one called ProductCategory, and the last called ProductGroup

You should delete the Excel file before repeating or you'll (potentially) get unexpected behavior.

Hope this helps.
0
 
LVL 12

Expert Comment

by:pique_tech
ID: 12174968
(That assumes that you're using MS Access...if not, then I'm pretty sure my method won't work.)
0
 
LVL 4

Expert Comment

by:ndegioia
ID: 12179626
Form what I can understand Execl can read sql staments.  If you are using a sql or access database you can write a stored proceedure to execute multiple queries.  Here is the sytax

create proceedure Myproceedure
as
Select yourColumn
Form YourTable
Where YourConditions
go
Select yourColumn
Form YourTable
Where YourConditions
go

...and so on


Then all you have to do in Execl of any other client side app is run

Exec MyProceedure
go


Note you must be connected to sql or save the stored prceedure as a Macro.

Hope this helps;)
0
 

Author Comment

by:lallentx
ID: 12179701
pique tech, I will try your approach first, and Yes! it is MS Access what I'm using.
I'll keep y'all posted.
0
 

Author Comment

by:lallentx
ID: 12183568
Pike tech,
you are a genius in my book!

it worked!

thanks so so much.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

947 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now