A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

query results to columns in excel



 
 
Thread Tools Display Modes
  #1  
Old February 23rd, 2007, 05:36 PM posted to microsoft.public.access.queries
Ian
external usenet poster
 
Posts: 485
Default query results to columns in excel

Can anyone tell me how to structure a query or output to turn two tables into
a single row in excel: I have one table with contractID in it that has a one
to many relationship with servicesID (eg many services to each contract).
When I build my query I get
ContractID/ServiceID
1/1
1/2
1/3 etc... (each in a column)
But I need to to show in excel with the first column as the contract and
each service (max 10) in the subsequent columns.
1/1/2/3 etc...

Any help appreciated.
  #2  
Old February 23rd, 2007, 11:15 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default query results to columns in excel

Sounds like a crosstab query might do it for you. Post a sample of your data.
--
KARL DEWEY
Build a little - Test a little


"Ian" wrote:

Can anyone tell me how to structure a query or output to turn two tables into
a single row in excel: I have one table with contractID in it that has a one
to many relationship with servicesID (eg many services to each contract).
When I build my query I get
ContractID/ServiceID
1/1
1/2
1/3 etc... (each in a column)
But I need to to show in excel with the first column as the contract and
each service (max 10) in the subsequent columns.
1/1/2/3 etc...

Any help appreciated.

  #3  
Old February 23rd, 2007, 11:24 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default query results to columns in excel

Maybe you are looking for something like this crosstab query ---

TRANSFORM First(IIf([ServiceID] Is Not Null,"X","")) AS Expr2
SELECT IAN_Many.contractID
FROM IAN_Many
GROUP BY IAN_Many.contractID
PIVOT "Service " & [ServiceID];

--
KARL DEWEY
Build a little - Test a little


"Ian" wrote:

Can anyone tell me how to structure a query or output to turn two tables into
a single row in excel: I have one table with contractID in it that has a one
to many relationship with servicesID (eg many services to each contract).
When I build my query I get
ContractID/ServiceID
1/1
1/2
1/3 etc... (each in a column)
But I need to to show in excel with the first column as the contract and
each service (max 10) in the subsequent columns.
1/1/2/3 etc...

Any help appreciated.

  #4  
Old February 24th, 2007, 06:14 PM posted to microsoft.public.access.queries
Ian
external usenet poster
 
Posts: 485
Default query results to columns in excel

YOU ROCK KARL. That took 2 seconds to use. Thank you so much. I owe you a
beer if you're in Canada. Ian.



"KARL DEWEY" wrote:

Maybe you are looking for something like this crosstab query ---

TRANSFORM First(IIf([ServiceID] Is Not Null,"X","")) AS Expr2
SELECT IAN_Many.contractID
FROM IAN_Many
GROUP BY IAN_Many.contractID
PIVOT "Service " & [ServiceID];

--
KARL DEWEY
Build a little - Test a little


"Ian" wrote:

Can anyone tell me how to structure a query or output to turn two tables into
a single row in excel: I have one table with contractID in it that has a one
to many relationship with servicesID (eg many services to each contract).
When I build my query I get
ContractID/ServiceID
1/1
1/2
1/3 etc... (each in a column)
But I need to to show in excel with the first column as the contract and
each service (max 10) in the subsequent columns.
1/1/2/3 etc...

Any help appreciated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.