View Single Post
  #2  
Old June 1st, 2010, 02:51 PM 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 am having a problem with a report. I am trying to print out paystubs for
employees over a given time period. I have a start up form in which the user
types in the “StartDate” and the “EndDate” of the pay period which is 2 weeks.
I need to be able to calculate the regular/overtime hours for each week so I
created two queries, “qryPayrollWeek1” and “qryPayrollWeek2”. Each of these
queries contains the same fields:
Operator/DateWorked/HoursWorked/RegularHours(Calculated Field)/OvertimeHours
(Calculated Field). Both of these queries work great. When I type in a
StartDate and EndDate, I get a record for each day for each employee within
the date range with all of the correct information.

I now want to produce a pay stub for each employee through a report. I built
a report and have 2 subreports (one referring to week 1 and one referring to
week 2). I have tried to have various tables/queries as the main report but
I keep getting asked for the Start/End dates over and over (I am assuming for
each record in each query as well as each record in the main part of the
report). This produces a report that is pages long. I do understand
Parent/Child fields and I have tried various combinations of what I think
would relate the main report with each subreport but no matter what
table/query I try and have as the main report, the same thing happens.

I am just wondering if I need to build a new query for the main part of the
report (and try ans SELECT DISTINCT for each employee within both payroll
queries) or if I should just somehow link back to the table which stores the
individual employee information (tblEmployees). The field “Operator” is not
the primary key but is found in tblEmployees as well as both the payroll
queries. I tried this once before already with no luck but maybe I am
looking at this the wrong way.



It sounds like your main report record source query joins to
the table that contains the data used in the subreport. If
so, then you should remove the subreport table from the main
report's query (the Link Master/Child properties will join
the subreport (data) to the main report records.

--
Marsh
MVP [MS Access]