C
Chris75 via AccessMonster.com
Hello,
Here is my question. I currently have an unbound field in a form referring
to a query. However, the dlookup is repeating the same information for each
record rather than giving distinct data.
=DLookUp("HRS","Prod Q","[EMPLOYEE ID]=" & [EMPLOYEE ID])
Prod Q is a query that returns the total amount of hours worked by an
employee in a week. When I run the query, everything is fine. I get the
week #, the total amount of hours and the employee ID. When I have checked
against the schedule, this matches :
SELECT DISTINCTROW Sum(([Schedule]![Time OUT]-[Schedule]![Time IN]-[Schedule]!
[TIME OFF]-[Schedule]![ANOMALY]+[Schedule]![OVERTIME]-1)) AS HRS, Employees.
[EMPLOYEE ID], Format$([Schedule].[WorkDate],'ww') AS WK
FROM Employees INNER JOIN Schedule ON Employees.[EMPLOYEE ID] = Schedule.
[EMPLOYEE ID]
GROUP BY Employees.[EMPLOYEE ID], Format$([Schedule].[WorkDate],'ww');
In a subform (Productivity), I have put the above dlookup in an unbound
textbox labelled HRS. Reason for this is that I want the total amount of
hours for a week to show so that a rate can be calculated. I also want to
ensure that if hours are changed in an employees schedule, this will reflect
automatically in the Productivity subform.
I'm not sure why the =dlookup is repeating the same data for each record when
the query gives me distinct returns based on the underlying data (from a
table called Schedule).
Any ideas?
Thank you!
It works correctly.
Here is my question. I currently have an unbound field in a form referring
to a query. However, the dlookup is repeating the same information for each
record rather than giving distinct data.
=DLookUp("HRS","Prod Q","[EMPLOYEE ID]=" & [EMPLOYEE ID])
Prod Q is a query that returns the total amount of hours worked by an
employee in a week. When I run the query, everything is fine. I get the
week #, the total amount of hours and the employee ID. When I have checked
against the schedule, this matches :
SELECT DISTINCTROW Sum(([Schedule]![Time OUT]-[Schedule]![Time IN]-[Schedule]!
[TIME OFF]-[Schedule]![ANOMALY]+[Schedule]![OVERTIME]-1)) AS HRS, Employees.
[EMPLOYEE ID], Format$([Schedule].[WorkDate],'ww') AS WK
FROM Employees INNER JOIN Schedule ON Employees.[EMPLOYEE ID] = Schedule.
[EMPLOYEE ID]
GROUP BY Employees.[EMPLOYEE ID], Format$([Schedule].[WorkDate],'ww');
In a subform (Productivity), I have put the above dlookup in an unbound
textbox labelled HRS. Reason for this is that I want the total amount of
hours for a week to show so that a rate can be calculated. I also want to
ensure that if hours are changed in an employees schedule, this will reflect
automatically in the Productivity subform.
I'm not sure why the =dlookup is repeating the same data for each record when
the query gives me distinct returns based on the underlying data (from a
table called Schedule).
Any ideas?
Thank you!
It works correctly.