Hello Everyone, I need some help with the following code. The "IF ... Then" statement does not work. I set the time in the myTime variable to 8:15 PM and when I step through the code, it just skips over this section straight to the End IF line. I believe the code is correct. Please advise. Thanks Patrick
If myTime >= #6:00:00 PM# And myTime <= #5:59:00 AM# Then
rst.MoveFirst
Do Until rst.EOF
If rst![ShiftDate] = myDate And (rst![ShiftTime] >= #6:00:00 PM# _
And rst![ShiftTime] <= #5:59:00 AM#) And rst![Shift] = "Nightshift" Then
Me.txtShiftDay.Value = rst![ShiftDay]
Me.txtShiftDate.Value = rst![ShiftDate]
Me.txtShiftTime.Value = rst![ShiftTime]
Me.cboShift.Value = rst![Shift]
Me.cboTechnicianII.Value = rst![TechIIEmp]
Me.cboTechnicianI.Value = rst![TechIEmp]
Me.cmdClose.SetFocus
Exit Do
End If
If rst![ShiftDate] = myDate And rst![Shift] = "Dayshift" Then Exit Do
rst.MoveNext
Loop
End If
If myTime >= #6:00:00 PM# And myTime <= #5:59:00 AM# Then
rst.MoveFirst
Do Until rst.EOF
If rst![ShiftDate] = myDate And (rst![ShiftTime] >= #6:00:00 PM# _
And rst![ShiftTime] <= #5:59:00 AM#) And rst![Shift] = "Nightshift" Then
Me.txtShiftDay.Value = rst![ShiftDay]
Me.txtShiftDate.Value = rst![ShiftDate]
Me.txtShiftTime.Value = rst![ShiftTime]
Me.cboShift.Value = rst![Shift]
Me.cboTechnicianII.Value = rst![TechIIEmp]
Me.cboTechnicianI.Value = rst![TechIEmp]
Me.cmdClose.SetFocus
Exit Do
End If
If rst![ShiftDate] = myDate And rst![Shift] = "Dayshift" Then Exit Do
rst.MoveNext
Loop
End If