group sections by year

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have built a report based on a query that is sorted by a case number.
There is also a date field. I'd like to get the report to group the cases by
year. The closest I've come is to get a header for each record that lists
the year by using the following code:

DatePart("yyyy",[CaseDate]) but this lists the year for each record
instead of listing the year once. I know I'm missing some simple piece, but
can't figure it out for the life of me.

What I want my report to look like is:

2000

CaseNumber1 CaseDate InvolvedParty
Case Number2...

and then on a new page

2001

CaseNumber1...

Thanks for the help
 
Your primary/first level of sorting and grouping should be using the
expression:
=Year([CaseDate])
 
Where do I do that at? When I went to the sorting and grouping, and placed
that expression in the field/expression spot, it sorted by the first number
of the date, but did not place it by year and sorted the dates wrong. I'm
sorry if you have to state the obvious...this one I know should be simple.....

Duane Hookom said:
Your primary/first level of sorting and grouping should be using the
expression:
=Year([CaseDate])

--
Duane Hookom
MS Access MVP
--

KGates said:
I have built a report based on a query that is sorted by a case number.
There is also a date field. I'd like to get the report to group the cases
by
year. The closest I've come is to get a header for each record that lists
the year by using the following code:

DatePart("yyyy",[CaseDate]) but this lists the year for each record
instead of listing the year once. I know I'm missing some simple piece,
but
can't figure it out for the life of me.

What I want my report to look like is:

2000

CaseNumber1 CaseDate InvolvedParty
Case Number2...

and then on a new page

2001

CaseNumber1...

Thanks for the help
 
KGates said:
I have built a report based on a query that is sorted by a case number.
There is also a date field. I'd like to get the report to group the cases by
year. The closest I've come is to get a header for each record that lists
the year by using the following code:

DatePart("yyyy",[CaseDate]) but this lists the year for each record
instead of listing the year once. I know I'm missing some simple piece, but
can't figure it out for the life of me.

What I want my report to look like is:

2000

CaseNumber1 CaseDate InvolvedParty
Case Number2...

and then on a new page

2001

CaseNumber1...


Use Sorting and Grouping (View menu) to specify the group.
Set the Field/Expression cell to the expression
=Year(CaseDate)

Towards the botton of the window, set the Group Header
property to Yes. Then back in the report's design window,
move the year text box to the group header section.
 
You place the expression in the sorting and grouping dialog. What do you
mean by "first number of the date"?
If you need additional sorting, you will need to add another
field/expression under the =Year([CaseDate]) level.

--
Duane Hookom
MS Access MVP
--

KGates said:
Where do I do that at? When I went to the sorting and grouping, and
placed
that expression in the field/expression spot, it sorted by the first
number
of the date, but did not place it by year and sorted the dates wrong. I'm
sorry if you have to state the obvious...this one I know should be
simple.....

Duane Hookom said:
Your primary/first level of sorting and grouping should be using the
expression:
=Year([CaseDate])

--
Duane Hookom
MS Access MVP
--

KGates said:
I have built a report based on a query that is sorted by a case number.
There is also a date field. I'd like to get the report to group the
cases
by
year. The closest I've come is to get a header for each record that
lists
the year by using the following code:

DatePart("yyyy",[CaseDate]) but this lists the year for each record
instead of listing the year once. I know I'm missing some simple
piece,
but
can't figure it out for the life of me.

What I want my report to look like is:

2000

CaseNumber1 CaseDate InvolvedParty
Case Number2...

and then on a new page

2001

CaseNumber1...

Thanks for the help
 
Back
Top