Date range by week on Report

S

Sunrise

I would like to group data on a report by week but can't figure out how to
build the expression. Data comes from a date field in a query.

Group titles would be like "For the week of July 6 to July 13, 2009", for
example.

(Using Access 2003.)
 
M

Marshall Barton

Sunrise said:
I would like to group data on a report by week but can't figure out how to
build the expression. Data comes from a date field in a query.

Group titles would be like "For the week of July 6 to July 13, 2009", for
example.

(Using Access 2003.)


Group on an expression like:

=DateAdd("d", 1 - WeekDay(datefield,2), datefield)
(the 2 means that Monday is the first day of the week)

You can use the same expression in the group header text
box's expression:

="For the week of " & Format(DateAdd("d", 1 -
WeekDay(datefield,2), datefield), "mmmm d") & " to " &
Format(DateAdd("d", 8 - WeekDay(datefield,2), datefield),
"mmmm d, yyyy")
 
D

Duane Hookom

When you select a date field in the sorting and grouping dialog, you have the
ability to set the Group On property to "Week".
 
M

Marshall Barton

Duane said:
When you select a date field in the sorting and grouping dialog, you have the
ability to set the Group On property to "Week".


Duane, if you use the Week option, how do you specify the
week starting day?
 
D

Duane Hookom

"how do you specify the week starting day?"
I suppose if you didn't like the grouping default for week, you could
subtract a day or so in the field/expression.
 
M

Marshall Barton

Duane said:
"how do you specify the week starting day?"
I suppose if you didn't like the grouping default for week, you could
subtract a day or so in the field/expression.


Ah, I did not think of that.
 

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

Similar Threads


Top