I have a continuous form with a Begin Date text box, among other text boxes. If the Begin Date is Null or contains no information when the user tabs off the Begin Date control I want to re-focus to the Begin Date box and force a date entry from the date picker. below is the validation code I am trying to use:
Private Sub txtBeginDate_BeforeUpdate(Cancel As Integer)
If IsNull(Me.txtBeginDate) Then
myMsg = MsgBox("You must enter a Begin Date!", vbInformation, "Invalid Begin Date")
Me.txtBeginDate.SetFocus
Cancel = True
End If
End Sub
I have also tried the same code for the On Lost Focus property.
The problem is that the focus does not return to the Begin Date control. Can someone tell me what I am doing wrong?