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  

Crosstab By Date (Month)



 
 
Thread Tools Display Modes
  #1  
Old February 25th, 2010, 04:24 PM posted to microsoft.public.access.queries
Terry
external usenet poster
 
Posts: 32
Default Crosstab By Date (Month)

I need to write a crosstab on a shipping table that has the Customer as the
row heading, month as the column heading, and sum of shipped as the value.
The crosstab wizard does this easy enough, but my problem is I need to have
the column heads (month) sort by year also. If I use the wizard and run a
crosstab on the last 6 months, it still sorts the colomns as Jan, Feb,
Mar,.......Dec. What I am going for is ....Sept 09, Oct 09, Nov09, Dec09,
Jan10, Feb10.

The data is correct the first way - just sorted wrong. Is there a way to do
this?
Thanks
Terry


  #2  
Old February 25th, 2010, 05:53 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Crosstab By Date (Month)

In the SQL view for the PIVOT statement use this with your field name --
PIVOT Format([YourDield], "mmm yy") IN("Sep 09", "Oct 09", "Nov 09",
"Dec09", "Jan 10", "Feb 10", "Mar 10")

The IN part will produce column names in the same order. But the FORMAT
must output the date in the exact manner as in the IN part.

--
Build a little, test a little.


"Terry" wrote:

I need to write a crosstab on a shipping table that has the Customer as the
row heading, month as the column heading, and sum of shipped as the value.
The crosstab wizard does this easy enough, but my problem is I need to have
the column heads (month) sort by year also. If I use the wizard and run a
crosstab on the last 6 months, it still sorts the colomns as Jan, Feb,
Mar,.......Dec. What I am going for is ....Sept 09, Oct 09, Nov09, Dec09,
Jan10, Feb10.

The data is correct the first way - just sorted wrong. Is there a way to do
this?
Thanks
Terry


.

  #3  
Old February 25th, 2010, 06:52 PM posted to microsoft.public.access.queries
Terry
external usenet poster
 
Posts: 32
Default Crosstab By Date (Month)

Is there a way to do this so that it is dynamic? I need to run this query
for differant time frames, and run it each month. It would be cumbersome to
have to change the "IN" statement each time.
Thanks for the help.

Terry
"KARL DEWEY" wrote in message
...
In the SQL view for the PIVOT statement use this with your field name --
PIVOT Format([YourDield], "mmm yy") IN("Sep 09", "Oct 09", "Nov 09",
"Dec09", "Jan 10", "Feb 10", "Mar 10")

The IN part will produce column names in the same order. But the FORMAT
must output the date in the exact manner as in the IN part.

--
Build a little, test a little.


"Terry" wrote:

I need to write a crosstab on a shipping table that has the Customer as
the
row heading, month as the column heading, and sum of shipped as the
value.
The crosstab wizard does this easy enough, but my problem is I need to
have
the column heads (month) sort by year also. If I use the wizard and run a
crosstab on the last 6 months, it still sorts the colomns as Jan, Feb,
Mar,.......Dec. What I am going for is ....Sept 09, Oct 09, Nov09, Dec09,
Jan10, Feb10.

The data is correct the first way - just sorted wrong. Is there a way to
do
this?
Thanks
Terry


.



  #4  
Old February 25th, 2010, 07:59 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Crosstab By Date (Month)

I have seen post that does.
Search on Dynamic Crosstab Heading

--
Build a little, test a little.


"Terry" wrote:

Is there a way to do this so that it is dynamic? I need to run this query
for differant time frames, and run it each month. It would be cumbersome to
have to change the "IN" statement each time.
Thanks for the help.

Terry
"KARL DEWEY" wrote in message
...
In the SQL view for the PIVOT statement use this with your field name --
PIVOT Format([YourDield], "mmm yy") IN("Sep 09", "Oct 09", "Nov 09",
"Dec09", "Jan 10", "Feb 10", "Mar 10")

The IN part will produce column names in the same order. But the FORMAT
must output the date in the exact manner as in the IN part.

--
Build a little, test a little.


"Terry" wrote:

I need to write a crosstab on a shipping table that has the Customer as
the
row heading, month as the column heading, and sum of shipped as the
value.
The crosstab wizard does this easy enough, but my problem is I need to
have
the column heads (month) sort by year also. If I use the wizard and run a
crosstab on the last 6 months, it still sorts the colomns as Jan, Feb,
Mar,.......Dec. What I am going for is ....Sept 09, Oct 09, Nov09, Dec09,
Jan10, Feb10.

The data is correct the first way - just sorted wrong. Is there a way to
do
this?
Thanks
Terry


.



.

  #5  
Old February 25th, 2010, 08:34 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Crosstab By Date (Month)

There is a solution that should work at
http://www.tek-tips.com/faqs.cfm?fid=5466.

--
Duane Hookom
Microsoft Access MVP


"KARL DEWEY" wrote:

I have seen post that does.
Search on Dynamic Crosstab Heading

--
Build a little, test a little.


"Terry" wrote:

Is there a way to do this so that it is dynamic? I need to run this query
for differant time frames, and run it each month. It would be cumbersome to
have to change the "IN" statement each time.
Thanks for the help.

Terry
"KARL DEWEY" wrote in message
...
In the SQL view for the PIVOT statement use this with your field name --
PIVOT Format([YourDield], "mmm yy") IN("Sep 09", "Oct 09", "Nov 09",
"Dec09", "Jan 10", "Feb 10", "Mar 10")

The IN part will produce column names in the same order. But the FORMAT
must output the date in the exact manner as in the IN part.

--
Build a little, test a little.


"Terry" wrote:

I need to write a crosstab on a shipping table that has the Customer as
the
row heading, month as the column heading, and sum of shipped as the
value.
The crosstab wizard does this easy enough, but my problem is I need to
have
the column heads (month) sort by year also. If I use the wizard and run a
crosstab on the last 6 months, it still sorts the colomns as Jan, Feb,
Mar,.......Dec. What I am going for is ....Sept 09, Oct 09, Nov09, Dec09,
Jan10, Feb10.

The data is correct the first way - just sorted wrong. Is there a way to
do
this?
Thanks
Terry


.



.

  #6  
Old February 25th, 2010, 10:15 PM posted to microsoft.public.access.queries
Terry
external usenet poster
 
Posts: 32
Default Crosstab By Date (Month)

Thx,
Works well. Appreciate the help!
Terry
"Duane Hookom" wrote in message
...
There is a solution that should work at
http://www.tek-tips.com/faqs.cfm?fid=5466.

--
Duane Hookom
Microsoft Access MVP


"KARL DEWEY" wrote:

I have seen post that does.
Search on Dynamic Crosstab Heading

--
Build a little, test a little.


"Terry" wrote:

Is there a way to do this so that it is dynamic? I need to run this
query
for differant time frames, and run it each month. It would be
cumbersome to
have to change the "IN" statement each time.
Thanks for the help.

Terry
"KARL DEWEY" wrote in message
...
In the SQL view for the PIVOT statement use this with your field
name --
PIVOT Format([YourDield], "mmm yy") IN("Sep 09", "Oct 09", "Nov 09",
"Dec09", "Jan 10", "Feb 10", "Mar 10")

The IN part will produce column names in the same order. But the
FORMAT
must output the date in the exact manner as in the IN part.

--
Build a little, test a little.


"Terry" wrote:

I need to write a crosstab on a shipping table that has the Customer
as
the
row heading, month as the column heading, and sum of shipped as the
value.
The crosstab wizard does this easy enough, but my problem is I need
to
have
the column heads (month) sort by year also. If I use the wizard and
run a
crosstab on the last 6 months, it still sorts the colomns as Jan,
Feb,
Mar,.......Dec. What I am going for is ....Sept 09, Oct 09, Nov09,
Dec09,
Jan10, Feb10.

The data is correct the first way - just sorted wrong. Is there a
way to
do
this?
Thanks
Terry


.



.



 




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 03:32 PM.


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