Remove prompt while running report

mercredi 8 avril 2015

I have a report that is created from the following query (qryTotalProjectHours). What I am trying to do is get the total hours spent on Tasks within a given time period. A given Task can we worked on by multiple individuals and hence I need to find a way to aggregate the hours spent.




Code:





SELECT TasksEntries.Project, TasksEntries.Task, Sum(TimeTracker.WorkHours) AS TotalHours

FROM TasksEntries INNER JOIN TimeTracker

ON (TasksEntries.EmployeeId = TimeTracker.EmployeeId) AND (TasksEntries.TaskID = TimeTracker.TaskId)

GROUP BY TasksEntries.Project, TasksEntries.Task;



I accept the start and end dates in a form and pass it like shown below. WorkDate is a column in the TimeTracker table and is not present in any other table.




Code:





strWhere = "WorkDate BETWEEN #" & txtMgrRptStartDate & "# AND #" & txtMgrRptEndDate & "#"

DoCmd.OpenReport "rptTotalProjectHours", acViewPreview, "qryTotalProjectHours", strWhere, acWindowNormal



When the report is invoked, I get a box where it says

"Enter parameter value" for Workdate..



Is there anyway I can get rid of the prompt? I never thought you needed the column name in the SELECT statement to be able to run this.



I should add the I tried the query with the WorkDate hardcoded in there and it worked fine and returned the correct results

Remove prompt while running report

0 commentaires:

Enregistrer un commentaire

Labels