From: SSi308 on
I created a form called frmWeeklyReport and added 2 unbound text boxes
one for start date and one for end date. There is also a button that is set
to run the report. I open the form, enter the dates and click the button. I
then get an Enter Parameter Value dialog box Start Date and End Date.

My Report includes a main report and a subreport each based on different
queries.

I think I know where to look for the error, but am not sure what to look
for. When running each query directly, with the form open and the dates
filled in, the first query is fine, but the second query is prompting for a
Start and End Date twice. I believe I entered the parameters the same in
each query and have compared them and do not see any differences, except the
table.field information. Here is the SQL View.

SELECT Employees.Department, Employees.Initials
, Sum(ContractsAndHours.DailyHours) AS TotalHoursWorked
, Sum(ContractsAndHours.OutNewBusiness) AS NBOut
, Sum(ContractsAndHours.OutRenewal) AS RnwlOut
, Sum(ContractsAndHours.InNewBusiness) AS NBIn
, Sum(ContractsAndHours.InRenewal) AS RnwlIn
, [TotalHoursWorked]/8 AS EquivDays
, CallsPerDay.[Out Calls]
, CallsPerDay.[In Calls]
, CallsPerDay.[Calls 3+]
, ([Out Calls]/[EquivDays]) AS [Avg Out Calls]
, ([In Calls]/[EquivDays]) AS [Avg In Calls]
, ([Calls 3+]/[EquivDays]) AS [Avg 3+ Calls]

FROM (ContractsAndHours INNER JOIN Employees ON ContractsAndHours.EmpID =
Employees.EmpID) INNER JOIN CallsPerDay ON Employees.EmpID = CallsPerDay.EmpID

WHERE
(((ContractsAndHours.DateOfRecord)>=[Forms]![frmWeeklyReport]![txtStartDate]
And
(ContractsAndHours.DateOfRecord)<DateAdd("d",1,[Forms]![frmWeeklyReport]![txtEndDate])))

GROUP BY Employees.Department, Employees.Initials, CallsPerDay.[Out Calls],
CallsPerDay.[In Calls], CallsPerDay.[Calls 3+];

Any help is appreciated.

Lori

From: SSi308 on
Thanks for the reply.
ContractsAndHours is a Table and CallsPerDay is a field in that table.

Lori

"KARL DEWEY" wrote:

> Is ContractsAndHours or CallsPerDay a query? If so, then check them against
> this query.
>
> --
> Build a little, test a little.
>
>
> "SSi308" wrote:
>
> > I created a form called frmWeeklyReport and added 2 unbound text boxes
> > one for start date and one for end date. There is also a button that is set
> > to run the report. I open the form, enter the dates and click the button. I
> > then get an Enter Parameter Value dialog box Start Date and End Date.
> >
> > My Report includes a main report and a subreport each based on different
> > queries.
> >
> > I think I know where to look for the error, but am not sure what to look
> > for. When running each query directly, with the form open and the dates
> > filled in, the first query is fine, but the second query is prompting for a
> > Start and End Date twice. I believe I entered the parameters the same in
> > each query and have compared them and do not see any differences, except the
> > table.field information. Here is the SQL View.
> >
> > SELECT Employees.Department, Employees.Initials
> > , Sum(ContractsAndHours.DailyHours) AS TotalHoursWorked
> > , Sum(ContractsAndHours.OutNewBusiness) AS NBOut
> > , Sum(ContractsAndHours.OutRenewal) AS RnwlOut
> > , Sum(ContractsAndHours.InNewBusiness) AS NBIn
> > , Sum(ContractsAndHours.InRenewal) AS RnwlIn
> > , [TotalHoursWorked]/8 AS EquivDays
> > , CallsPerDay.[Out Calls]
> > , CallsPerDay.[In Calls]
> > , CallsPerDay.[Calls 3+]
> > , ([Out Calls]/[EquivDays]) AS [Avg Out Calls]
> > , ([In Calls]/[EquivDays]) AS [Avg In Calls]
> > , ([Calls 3+]/[EquivDays]) AS [Avg 3+ Calls]
> >
> > FROM (ContractsAndHours INNER JOIN Employees ON ContractsAndHours.EmpID =
> > Employees.EmpID) INNER JOIN CallsPerDay ON Employees.EmpID = CallsPerDay.EmpID
> >
> > WHERE
> > (((ContractsAndHours.DateOfRecord)>=[Forms]![frmWeeklyReport]![txtStartDate]
> > And
> > (ContractsAndHours.DateOfRecord)<DateAdd("d",1,[Forms]![frmWeeklyReport]![txtEndDate])))
> >
> > GROUP BY Employees.Department, Employees.Initials, CallsPerDay.[Out Calls],
> > CallsPerDay.[In Calls], CallsPerDay.[Calls 3+];
> >
> > Any help is appreciated.
> >
> > Lori
> >
From: SSi308 on
Karl,

Not sure what I had wrong, but I corrected the issue by deleting and
recreating the queries. By the way my answer to your question was, of course,
incorrect.
ContractsAndHours and CallsPerDay are indeed a queries. Thats what I get for
naming the tables and queries the same, lesson learned.
The CallsPerDay query ran fine, the SQL view I had posted was from the
ContractsAndHours query which I knew was not running the way it should and
was the reason for my question in the first place.

At any rate everything is working fine.

Lori

"KARL DEWEY" wrote:

> Is ContractsAndHours or CallsPerDay a query? If so, then check them against
> this query.
>
> --
> Build a little, test a little.
>
>
> "SSi308" wrote:
>
> > I created a form called frmWeeklyReport and added 2 unbound text boxes
> > one for start date and one for end date. There is also a button that is set
> > to run the report. I open the form, enter the dates and click the button. I
> > then get an Enter Parameter Value dialog box Start Date and End Date.
> >
> > My Report includes a main report and a subreport each based on different
> > queries.
> >
> > I think I know where to look for the error, but am not sure what to look
> > for. When running each query directly, with the form open and the dates
> > filled in, the first query is fine, but the second query is prompting for a
> > Start and End Date twice. I believe I entered the parameters the same in
> > each query and have compared them and do not see any differences, except the
> > table.field information. Here is the SQL View.
> >
> > SELECT Employees.Department, Employees.Initials
> > , Sum(ContractsAndHours.DailyHours) AS TotalHoursWorked
> > , Sum(ContractsAndHours.OutNewBusiness) AS NBOut
> > , Sum(ContractsAndHours.OutRenewal) AS RnwlOut
> > , Sum(ContractsAndHours.InNewBusiness) AS NBIn
> > , Sum(ContractsAndHours.InRenewal) AS RnwlIn
> > , [TotalHoursWorked]/8 AS EquivDays
> > , CallsPerDay.[Out Calls]
> > , CallsPerDay.[In Calls]
> > , CallsPerDay.[Calls 3+]
> > , ([Out Calls]/[EquivDays]) AS [Avg Out Calls]
> > , ([In Calls]/[EquivDays]) AS [Avg In Calls]
> > , ([Calls 3+]/[EquivDays]) AS [Avg 3+ Calls]
> >
> > FROM (ContractsAndHours INNER JOIN Employees ON ContractsAndHours.EmpID =
> > Employees.EmpID) INNER JOIN CallsPerDay ON Employees.EmpID = CallsPerDay.EmpID
> >
> > WHERE
> > (((ContractsAndHours.DateOfRecord)>=[Forms]![frmWeeklyReport]![txtStartDate]
> > And
> > (ContractsAndHours.DateOfRecord)<DateAdd("d",1,[Forms]![frmWeeklyReport]![txtEndDate])))
> >
> > GROUP BY Employees.Department, Employees.Initials, CallsPerDay.[Out Calls],
> > CallsPerDay.[In Calls], CallsPerDay.[Calls 3+];
> >
> > Any help is appreciated.
> >
> > Lori
> >