A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Entering Report Parameters through a Form



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 10:40 PM posted to microsoft.public.access.reports
SSi308
external usenet poster
 
Posts: 42
Default Entering Report Parameters through a Form

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

Ads
  #2  
Old May 28th, 2010, 12:00 AM posted to microsoft.public.access.reports
SSi308
external usenet poster
 
Posts: 42
Default Entering Report Parameters through a Form

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

  #3  
Old May 28th, 2010, 03:59 PM posted to microsoft.public.access.reports
SSi308
external usenet poster
 
Posts: 42
Default Entering Report Parameters through a Form

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright 2004-2020 OfficeFrustration.
The comments are property of their posters.