G
Guest
I have code that is supposed to automatically determine what shift
information was entered on based on the time of the entry. This occurs after
the "Add_record" button is clicked.
The problem is, no matter what time data is entered, the shift is always
"3". Why is this?
Private Sub Add_record_Click()
On Error GoTo Err_Add_record_Click
If Entry_time > #7:00:00 AM# And Entry_time <= #3:30:00 PM# Then
Shift = 1
ElseIf Entry_time > #3:30:00 PM# And Entry_time <= #12:00:00 AM# Then
Shift = 2
ElseIf Entry_time > #12:00:00 AM# And Entry_time <= #7:00:00 PM# Then
Shift = 3
End If
DoCmd.GoToRecord , , acNewRec
Exit_Add_record_Click:
Exit Sub
Err_Add_record_Click:
MsgBox Err.Description
Resume Exit_Add_record_Click
End Sub
Thanks for any suggestions.
information was entered on based on the time of the entry. This occurs after
the "Add_record" button is clicked.
The problem is, no matter what time data is entered, the shift is always
"3". Why is this?
Private Sub Add_record_Click()
On Error GoTo Err_Add_record_Click
If Entry_time > #7:00:00 AM# And Entry_time <= #3:30:00 PM# Then
Shift = 1
ElseIf Entry_time > #3:30:00 PM# And Entry_time <= #12:00:00 AM# Then
Shift = 2
ElseIf Entry_time > #12:00:00 AM# And Entry_time <= #7:00:00 PM# Then
Shift = 3
End If
DoCmd.GoToRecord , , acNewRec
Exit_Add_record_Click:
Exit Sub
Err_Add_record_Click:
MsgBox Err.Description
Resume Exit_Add_record_Click
End Sub
Thanks for any suggestions.