By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,743 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,743 IT Pros & Developers. It's quick & easy.

Crosstab queries to be exported to same worksheet

P: 15
Hi,
I have three crosstab queries to be exported to the same excel worksheet. How can I achieve this? If there is any link that would explain the form details behind crosstab queries, it would be helpful.
Thanks,
Prasanna.
Oct 29 '07 #1
Share this Question
Share on Google+
4 Replies


nico5038
Expert 2.5K+
P: 3,072
Do you need to have them in the same worksheet or workbook?
For a workbook you can add the intended sheetname to the DoCmd.TransferSpreadsheet command as the last parameter.

For multiple queries to the same sheet it would be the easiest when the structure (columns) is identical. Then a UNION query can be used to concatenate the rows and save the rows into one sheet.

Nic;o)
Oct 30 '07 #2

P: 15
Do you need to have them in the same worksheet or workbook?
For a workbook you can add the intended sheetname to the DoCmd.TransferSpreadsheet command as the last parameter.

For multiple queries to the same sheet it would be the easiest when the structure (columns) is identical. Then a UNION query can be used to concatenate the rows and save the rows into one sheet.

Nic;o)
Hi Nic,
I want the queries to be populated in the same sheet. However, there are three different queries to be populated at 3 different places on the worksheet.
Can UNION query be used for this sort of situation? If you can provide me some online links or throw me some idea to achieve this, it would be great.
Thanks,
prasanna.
Oct 31 '07 #3

nico5038
Expert 2.5K+
P: 3,072
A UNION will only work when you're able to fit the same number of columns and the same column datatypes per query.

The slower but 100% working solution would be to use automation (=VBA code) to directly place the data into the excelsheet.
Check: http://visualbasic.ittoolbox.com/gro...21?cv=expanded for some sample code.

Nic;o)
Oct 31 '07 #4

NeoPa
Expert Mod 15k+
P: 31,416
We also have an Application Automation article here for the basics of how to get started with it.

I believe you can also export multiple queries to separate worksheets in the same workbook (file) if that's any good. It would not be exactly all on the same sheet but might be ok.
Nov 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.