Solved

export multiple queries to 1 excel spreadsheet

Posted on 2004-09-28
5
925 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…

708 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

20 Experts available now in Live!

Get 1:1 Help Now