nubianqueen
Technical User
I have two fields (CallInDateTime)&(CallFinishDateTime)with the format as mm/dd/yyyy h:nnAM/PM. Big problem with users forgetting to put in the time portion and of course 12AM defaults in. To prevent all the time spent on cleaning up my tables I put code in the BeforeUpdate event on my form so the record would not be saved until time is corrected by user. I need some help, code not working, doesn't even create error message.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If CallInDateTime = "#mm/dd/yyyy# 12:00AM" Then
MsgBox "You must enter a time that is before midnight.", vbExclamation
CallInDateTime.SetFocus 'Go back to DateTimefield.
Cancel = True 'Cancel saving the record.
End If
Thanks,
nubianqueen
Private Sub Form_BeforeUpdate(Cancel As Integer)
If CallInDateTime = "#mm/dd/yyyy# 12:00AM" Then
MsgBox "You must enter a time that is before midnight.", vbExclamation
CallInDateTime.SetFocus 'Go back to DateTimefield.
Cancel = True 'Cancel saving the record.
End If
Thanks,
nubianqueen