Okay, I have a date field in a form from a single table that needs to be "required". I have tried: IS Not Null, <>0 and <> "" in the validation rule of the text box. These do not work. I have also placed the following code in the Before Update and Lost Focus events:
Private Sub Request_Recvd_Dt_LostFocus()
If Not IsDate(Me!Request_Recvd_Dt) Then
MsgBox "You must enter a date!"
Cancel = True
Me.Undo
Me!Request_Recvd_Dt.SetFocus
End If
End Sub
Both of these work about half way. After clicking OK in the Message Box, you can just move right past the field and proceed to save the form. The SetFocus line does not work at all with or without the Me!
I have also tried adding this code to my Save and Close command button.
Any ideas?
Private Sub Request_Recvd_Dt_LostFocus()
If Not IsDate(Me!Request_Recvd_Dt) Then
MsgBox "You must enter a date!"
Cancel = True
Me.Undo
Me!Request_Recvd_Dt.SetFocus
End If
End Sub
Both of these work about half way. After clicking OK in the Message Box, you can just move right past the field and proceed to save the form. The SetFocus line does not work at all with or without the Me!
I have also tried adding this code to my Save and Close command button.
Any ideas?