473,802 Members | 2,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 Queries Export to Excel in the same spreadsheet

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

1. QryProrationbyW BS_1
2. QryProrationbyW BS_2

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

I have the following 2 commands attached to a command button:
1) DoCmd.OutputTo acOutputQuery, "QryProrationby WBS_1", acFormatXLS,
"C:\Documen ts and Settings\All Users\Desktop\C onsumbles Report.xls",
False
2) DoCmd.OutputTo acOutputQuery, "QryProrationby WBS_2", acFormatXLS,
"C:\Documen ts and Settings\All Users\Desktop\C onsumbles 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 2444
ADezii
8,834 Recognized Expert Expert
I would like to export the output of 2 queries to excel namely:

1. QryProrationbyW BS_1
2. QryProrationbyW BS_2

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

I have the following 2 commands attached to a command button:
1) DoCmd.OutputTo acOutputQuery, "QryProrationby WBS_1", acFormatXLS,
"C:\Documen ts and Settings\All Users\Desktop\C onsumbles Report.xls",
False
2) DoCmd.OutputTo acOutputQuery, "QryProrationby WBS_2", acFormatXLS,
"C:\Documen ts and Settings\All Users\Desktop\C onsumbles 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.m db)
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.TransferS preadsheet will do that for you, e.g.

DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9, _
"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
864
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 that contains a number of labeled cells and sheets. When someone clicks the "Export to Excel" button on my asp page, I want to export the required data from my sql database to the Excel spreadsheet (putting the data in the appropriate cells and...
4
14795
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 a single table to Excel but have problems with multimple tables. Thanks.
4
3134
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 and Excel spreadsheet. Since the data often comes from many different tables, I have decided to create a temporary Access table, put all the data into it then use the Docmd.TransferSpreadsheet command to output the table to a spreadsheet. In...
1
1864
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
2298
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 9 WMC 2.94 VA Med Ctr 265 VA 86.60 32 VA Res Clinic 10.45 <blank row>
3
11691
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 DataSet that consists of one DataTable. That DataTable has a specific name (for arguments purposes, let's say it's called "DataGrid"), that I need to use as the tab name in the exported Excel
3
3051
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 do this thru the module, and I don't see how I can export a txt file from access without loading it to a temp table first. I've checked out the DoCmd.TransferText methods, where you have to have a table or query or schema ini first, and the...
4
2078
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 you give me the step to do this ? Thank u,
7
28909
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 actually do something more with. This code shows you how to display data from your database and then how to give that data to the user in the form of a useable Excel spreadsheet which they can then take away and play with themselves. The way I have shown...
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9559
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10529
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10301
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10280
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10058
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9107
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3788
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.