View Single Post
  #6  
Old June 2nd, 2010, 10:28 AM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Subreport Keeps Repeating Itself

Joel_123 via AccessMonster.com wrote:

I use the Start/End Date fields from the Forms in the criteria section of the
query (ie) under the DateWorked field, I have "Between [Forms]![frmPayroll]!
[StartDate] and [Forms]![frmPayroll]![EndDate]". All I am trying to
accomplish is to print off a piece of paper for each person that shows Week
One broken down for each individual day showing the regular/overtime hours
and then the same for Week 2. The reason I kept these two queries seperate
is because I need to be able to total the hours for each week seperately. I
was just trying to figure out a way so that the Operator shows up on the Main
Form and then the two subreports simply return the DateWorked, RegularHours,
and OvertimeHours for that particular operator. I also tried creating a new
report based on the WeekOne Query and adding the Week 2 query as a subreport
(so to only have one subreport) but it produces the same results.

I am wondering if I have over complicated this?



I think my original diagnosis may have been close. If the
main report's only data is the person and date, then the
main report's record source query should only contain the
person table. There would be no grouping since the detail
section would have the person info and the subreports. The
Link Master/Child properties whould have the person id to
link to the subreports fot the person.

OTOH, I don't think you actually need the subreports. If I
understand what you want, I think this would be my preferred
approach. Add a calculated field with the week (1 or 2) to
the main report's record source query using an expression
like:
WeekNum: DateDiff("ww", Forms!frmPayroll!StartDate,
datefield) + 1

Then add a group on the WeekNum field and total each week in
the WeekNum group footer section with Sum expressions. The
grand total for both weeks would be the same expressions in
the person group footer.

--
Marsh
MVP [MS Access]