Why am I asked to enter parameter value?

J

JZ

My query calculates the percent of hours worked on a project compared
to total hours worked. Here are the relevant fields:

Field: HoursWorked
Table: MainProjectTable
Total: Sum

Field: SumofHoursWorked
Table: qryTtlHrs

Field:percent: [SumOfHoursWorked1]/qryTtlHrs!SumOfHoursWorked

When I run the query I'm asked to enter parameter value for
[SumOfHoursWorked1] even though the criteria row is empty for all of
these fields. I hit OK and the query runs perfectly. How do I get rid
of the Enter Parameter Message Box? Any help would be much
appreciated. Thanks in advance.

-JZ
 
G

Guest

It is prompting for that because you did not tell it where to find the data --
Field:percent: [SumOfHoursWorked1] /qryTtlHrs!SumOfHoursWorked
 
J

JZ

Thanks for the response Karl. I built Percent:
[SumOfHoursWorked1]/qryTtlHrs!SumOfHoursWorked in the expression
builder. Access added the 1 at the end of [SumOfHoursWorked1] because
I am dividing two different sums of the same HoursWorked field. I
tried
[qryPrcnt]![SumOfHoursWorked] /[qryTtlHrs]![SumOfHoursWorked],
where qryPrcnt is the query I'm working on, but that did not work. Any
suggestions on what to try next?

-JZ
 
G

Guest

Percent is actual divided by possible. Unless you use a subquery you will
not have the possible to divide unto the actual.

You can use a totals query to get the possible or assume a fixed number for
the possible like 8 hours per day.
 
J

JZ

Sorry Karl, but I'm a little confused. I'm already using a sub query,
"qryTtlHrs", to calculate the denominator of the Percent expression.

-JZ
 
G

Guest

Post your SQL statement - open query in design view, click on menu VIEW - SQL
View. Hightlight, copy, and paste in a post.
 
J

JZ

SELECT DISTINCTROW ProjectList.[Primary Key],
MainProjectTable.ProjectID, ProjectList.AssignedEngineer,
Sum(MainProjectTable.HoursWorked) AS SumOfHoursWorked1,
qryTtlHrs.SumOfHoursWorked,
[SumOfHoursWorked1]/[qryTtlHrs]![SumOfHoursWorked] AS [Percent]
FROM (qryTtlHrs INNER JOIN ProjectList ON qryTtlHrs.EmployeeName =
ProjectList.AssignedEngineer) INNER JOIN MainProjectTable ON
ProjectList.[Primary Key] = MainProjectTable.ProjectID
GROUP BY ProjectList.[Primary Key], MainProjectTable.ProjectID,
ProjectList.AssignedEngineer, qryTtlHrs.SumOfHoursWorked,
[SumOfHoursWorked1]/[qryTtlHrs]![SumOfHoursWorked],
MainProjectTable.EmployeeName
HAVING (((MainProjectTable.EmployeeName)=[AssignedEngineer]));

-JZ
 
G

Guest

I am not up to snuff on subqueries but I do see where [SumOfHoursWorked1]
comes from.
I would recommend you building a separate query if someone can not help with
the subquery.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top