473,395 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

2 Queries Export to Excel in the same spreadsheet

I would like to export the output of 2 queries to excel namely:

1. QryProrationbyWBS_1
2. QryProrationbyWBS_2

However I want to do this using the same spreadsheet say sheet1 and
sheet2 or better still with sheet name "ProrationWBS1" and
"ProrationWBS2", how do I do this with acOutputQuery

I have the following 2 commands attached to a command button:
1) DoCmd.OutputTo acOutputQuery, "QryProrationbyWBS_1", acFormatXLS,
"C:\Documents and Settings\All Users\Desktop\Consumbles Report.xls",
False
2) DoCmd.OutputTo acOutputQuery, "QryProrationbyWBS_2", acFormatXLS,
"C:\Documents and Settings\All Users\Desktop\Consumbles Report.xls",
False

How do I combine both of the above outputs such that they both come on
a single spreadsheet

Many thanks for your help in advance
Edward

May 21 '06 #1
3 2430
ADezii
8,834 Expert 8TB
I would like to export the output of 2 queries to excel namely:

1. QryProrationbyWBS_1
2. QryProrationbyWBS_2

However I want to do this using the same spreadsheet say sheet1 and
sheet2 or better still with sheet name "ProrationWBS1" and
"ProrationWBS2", how do I do this with acOutputQuery

I have the following 2 commands attached to a command button:
1) DoCmd.OutputTo acOutputQuery, "QryProrationbyWBS_1", acFormatXLS,
"C:\Documents and Settings\All Users\Desktop\Consumbles Report.xls",
False
2) DoCmd.OutputTo acOutputQuery, "QryProrationbyWBS_2", acFormatXLS,
"C:\Documents and Settings\All Users\Desktop\Consumbles Report.xls",
False

How do I combine both of the above outputs such that they both come on
a single spreadsheet

Many thanks for your help in advance
Edward
What you are describing can quite easily be implemented within Excel, not
Access, and possibly automated via an Excel Macro. Here it goes:
01) Select cell A1 in Excel
02) Select the Data Menu
03) Select Import External Data
04) Select Import Data
05) Select you Data Source (YourDatabase.mdb)
06) Select qryProbationWBS_1
07) Go
08) Make sure Existing Worksheet is selected with Cell = $A$1
09) Import Data
10) Repeate the process for qryProbationWBS_2 but with a different
starting Cell location. e.g. =$A$200

Hope this helps
May 21 '06 #2
>How do I combine both of the above outputs such that they
both come on a single spreadsheet


DoCmd.TransferSpreadsheet will do that for you, e.g.

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
"Query1", "d:\foo.xls"

May 21 '06 #3
Thanks, it worked

May 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason | last post by:
Can anyone point me to some sample code or tutorial that shows how I can export data from a database to an Excel spreadsheet that is already created on the server? I have an Excel spreadsheet...
4
by: Paolo | last post by:
Friends, I need help with some code to export different tables to a single spreadsheet in Excel. My excel file is named REPORT and the spreadsheet is named CLIENTS. I do have the code to export...
4
by: Gary Wright | last post by:
I have an Access 2K database split into front and back. Quite often the users want to do some data analysis that I have not created a report for so they want to export some subset of the data into...
1
by: runners4bush | last post by:
Is it possible for access to export data from multiple Access database queries to seperate sheets in the same excel spreadsheet? for example q010_report_by_units q020_report_by_dollars to
1
by: Ellen Manning | last post by:
I'm trying to export an Excel2K spreadsheet to A2K. Here is a sample of the Excel spreadsheet: LastName FirstName Hours Location HoursPercent Doe John ...
3
by: Scott M. Lyon | last post by:
I'm trying to figure out a way to export data (actually the result of a Stored Procedure call from SQL Server) into a specified Excel spreadsheet format. Currently, I have the data read into a...
3
by: excyauseme | last post by:
Hi guys! Do you know what is the best way to export a text file, this one is a log file that is already comma delimited thru a module run by my access database, to an excel spreadsheet? I need to...
4
by: Belgarath | last post by:
Hello all, I'm a newbie in Access... And before starting to explore this software, I would like to know if it's possible to automate everyday queries result in Excel . If it's possible can...
7
Merlin1857
by: Merlin1857 | last post by:
Its great producing data for users to look at in your web pages and generally that is sufficient for their needs but sometimes you may want to supply your user with the data in a form they can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.