Crosstab Query - Group by Month and Year

N

Nate

I've created a crosstab query that counts the number of calls per month. The
call field only contains a date. I've used that field as the column header
and chose to group it by month, but can't get it to seperate the months by
year. For instance all of March is grouped together whether it's March, 2009
or March, 2010. I'm pretty new to Access so I'm not familiar with SQL or
VBA. Any assistance would be greatly appreciated. Thanks,

Nate
Access 2003
 
E

eggie

Nate said:
I've created a crosstab query that counts the number of calls per month.
The
call field only contains a date. I've used that field as the column
header
and chose to group it by month, but can't get it to seperate the months by
year. For instance all of March is grouped together whether it's March,
2009
or March, 2010. I'm pretty new to Access so I'm not familiar with SQL or
VBA. Any assistance would be greatly appreciated. Thanks,

Nate
Access 2003
 
B

Bob Quintal

I've created a crosstab query that counts the number of calls per
month. The call field only contains a date. I've used that field
as the column header and chose to group it by month, but can't get
it to seperate the months by year. For instance all of March is
grouped together whether it's March, 2009 or March, 2010. I'm
pretty new to Access so I'm not familiar with SQL or VBA. Any
assistance would be greatly appreciated. Thanks,

Nate
Access 2003

In the query design view, change the call field to a calculated field
based on Year(call) &"-" & Month(call)
 
B

Bob Quintal

I would use:
Format([Call],"yyyy-mm")
That works too, but somewhere I got the impression that
year([call] & "-" & month([call]) was marginally faster.
 
D

Duane Hookom

It might be marginally faster but I doubt you could tell unless your data
set is huge. My suggestion will format Jan as 01 with the leading 0. This
will sort the columns from left to right as you would expect to see them
2009-01, 2009-02,...2009-12 rather than 2009-1, 2009-10, 2009-11,... 2009-9.

--
Duane Hookom
MS Access MVP


Bob Quintal said:
I would use:
Format([Call],"yyyy-mm")
That works too, but somewhere I got the impression that
year([call] & "-" & month([call]) was marginally faster.
 
B

Bob Quintal

It might be marginally faster but I doubt you could tell unless
your data set is huge. My suggestion will format Jan as 01 with
the leading 0. This will sort the columns from left to right as
you would expect to see them 2009-01, 2009-02,...2009-12 rather
than 2009-1, 2009-10, 2009-11,... 2009-9.

right.
 
D

De Jager

Nate said:
I've created a crosstab query that counts the number of calls per month.
The
call field only contains a date. I've used that field as the column
header
and chose to group it by month, but can't get it to seperate the months by
year. For instance all of March is grouped together whether it's March,
2009
or March, 2010. I'm pretty new to Access so I'm not familiar with SQL or
VBA. Any assistance would be greatly appreciated. Thanks,

Nate
Access 2003
 
B

Bob Quintal

Re: Crosstab Query - Group by Month and Year
Pouvez vous parlez en français
!!!
Yes I can but not here. This is an International group discussing the
Microsoft Access database program..
 
Á

áÎÁÓÔÁÓÉÑ ëÏÒÎÅÊÞÕË

"ëÏÒÎÅÊÞÕË" (e-mail address removed)
ÓÏÏÂÝÉÌÁ ÓÌÅÄÕÀÝÅÅ:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top