D
dp
Hi guys,
I have got a datasheet based on a find duplicates query. So the query find
employees that are duplicated for a given day. I would also like to find if
first duplicate end time overlaps 2nd duplicates start time then set some
kind of conditioning on the datasheet. I was going to try to do some sort of
sql count if the 2 duplicates had overlapped, but I cannot figure out the
query.
SELECT FUNCTIONDATE, qryEventByBooking.EmpName,
qryEventByBooking.FUNCTIONSTARTTIME, qryEventByBooking.FUNCTIONENDTIME,
qryEventByBooking.FUNCTIONTYPE, qryEventByBooking.START,
qryEventByBooking.FINISH, qryEventByBooking.StaffID
FROM qryEventByBooking
WHERE (((qryEventByBooking.FUNCTIONDATE) In (SELECT [FUNCTIONDATE] FROM
[qryEventByBooking] As Tmp GROUP BY [FUNCTIONDATE],[EmpName] HAVING
Count(*)>1 And [EmpName] = [qryEventByBooking].[EmpName])))
So, then I tried doing it using the forms recordset clone, however, I wanted
to access that records employee control to change the colour and I cant seem
to get the control to access:
Code:
.MoveFirst
Me.Visible = True
sOldName = ""
dtOldEndTIme =null
Do Until .EOF
If sOldName = !EmpName And !START <= dtOldEndTIme Then '
Duplicate Employee
' .FindFirst "[StaffID]=" & rs!StaffID ' this did not work
' !EmpName.BackColor = 128 'This doesnt work either
Debug.Print !EmpName, !StaffID
End If
sOldName = Nz(!EmpName, "")
dtOldEndTIme =!FINISH
.MoveNext
Loop
Im a bit stuck, thanks so much
dp
I have got a datasheet based on a find duplicates query. So the query find
employees that are duplicated for a given day. I would also like to find if
first duplicate end time overlaps 2nd duplicates start time then set some
kind of conditioning on the datasheet. I was going to try to do some sort of
sql count if the 2 duplicates had overlapped, but I cannot figure out the
query.
SELECT FUNCTIONDATE, qryEventByBooking.EmpName,
qryEventByBooking.FUNCTIONSTARTTIME, qryEventByBooking.FUNCTIONENDTIME,
qryEventByBooking.FUNCTIONTYPE, qryEventByBooking.START,
qryEventByBooking.FINISH, qryEventByBooking.StaffID
FROM qryEventByBooking
WHERE (((qryEventByBooking.FUNCTIONDATE) In (SELECT [FUNCTIONDATE] FROM
[qryEventByBooking] As Tmp GROUP BY [FUNCTIONDATE],[EmpName] HAVING
Count(*)>1 And [EmpName] = [qryEventByBooking].[EmpName])))
So, then I tried doing it using the forms recordset clone, however, I wanted
to access that records employee control to change the colour and I cant seem
to get the control to access:
Code:
.MoveFirst
Me.Visible = True
sOldName = ""
dtOldEndTIme =null
Do Until .EOF
If sOldName = !EmpName And !START <= dtOldEndTIme Then '
Duplicate Employee
' .FindFirst "[StaffID]=" & rs!StaffID ' this did not work
' !EmpName.BackColor = 128 'This doesnt work either
Debug.Print !EmpName, !StaffID
End If
sOldName = Nz(!EmpName, "")
dtOldEndTIme =!FINISH
.MoveNext
Loop
Im a bit stuck, thanks so much
dp