Okay: this will need stacked queries and an outer join.
Step 1: Aggregating query.
Format() returns a string.
It would be better to use DatePart(), i.e.:
WeekNum: DatePart("ww", [Start Date])
Save this query for step 3 below.
Step 2: Table of week numbers.
The missing weeks have to come from somewhere.
Create a table with just one field:
Name CountID
Data Type Number (rather than AutoNumber)
Make this field the primary key, and save the table with a name such as
tblCount. Enter the values 1 to 53. (Yes, there can be a 53rd week.)
Step 3: Combine into another query.
Create a new query, using your original query as an input "table".
Add tblCount as well.
In the upper pane, join WeekNum to CountID.
Double-click this join line, and choose:
All records from tblCount, and any matches from ...
The query then shows all the weeks (1 - 53), and any matching data from the
other query.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Little pete said:
Morning
Sorted out half of it with the below;
Expr1: Format([Start Date],"ww")
But how can I show the weeks that have no information or data, ie want
weeks
1-52 on the report.
Thanks again for any help.
Cheers
:
I have a date field in the format 01-jan-04 and would like to report on
data
to show by week, ie Week 1, Week 2 etc. I need to find out how to group
my
data using a by week function. Thanks for any help you can give.
Pete