sherlocked
Registered User.
- Local time
- Yesterday, 21:13
- Joined
- Sep 22, 2014
- Messages
- 125
Hello Experts!
I am attempting to count the number of distinct employee ID values in my query results, with little luck. Trying to design a pop-up window that shows the total. Below is my code. It's counting the values, but not correctly - it's not eliminating duplicates.
The SQL behind my query is also below, in case that helps. Any ideas what I'm doing wrong?
I am attempting to count the number of distinct employee ID values in my query results, with little luck. Trying to design a pop-up window that shows the total. Below is my code. It's counting the values, but not correctly - it's not eliminating duplicates.
The SQL behind my query is also below, in case that helps. Any ideas what I'm doing wrong?
Code:
Private Sub btnTEST_Click()
Dim Count As Integer
Count = DCount("[Employee Number]", "qryOTEmployeeCount")
MsgBox "A total of " & Count & " employees worked OT between these dates.", vbOKOnly + vbInformation
End Sub
Code:
SELECT OvertimeWorked.[Employee Number]
FROM OvertimeWorked
GROUP BY OvertimeWorked.[Employee Number], OvertimeWorked.[Time OUT], OvertimeWorked.VerifiedBy, OvertimeWorked.VerifiedDate, OvertimeWorked.NotWorked
HAVING (((OvertimeWorked.[Time OUT]) Between [forms]![frmSupDash2]![txtStartDate] And [forms]![frmSupDash2]![txtEndDate]) AND ((OvertimeWorked.VerifiedBy) Is Not Null) AND ((OvertimeWorked.VerifiedDate) Is Not Null) AND ((OvertimeWorked.NotWorked)=No));