?
Solved

export multiple queries to 1 excel spreadsheet

Posted on 2004-09-28
5
Medium Priority
?
933 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
pique_tech earned 1000 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

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

Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 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