I have a userform where I am trying to check that a valid date is added into a textbox. If the entry is not a valid date, I want to clear the textbox, and give it the focus again, ready for the correct format date to be entered. I would also like to stop the user tabbing past the textbox without entering anything.
Whatever I have tried has not worked - the focus goes to the next control. I feel it is because I am using the wrong event (but probably because I'm not very competent in VBA programming )
My code is below...
Private Sub txbACDateClosed_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(txbACDateClosed) = False Then
MsgBox "You must enter a valid date...", vbOKOnly
txbACActionNumber.SetFocus
Exit Sub
End If
End Sub
All and any help greatly appreciated.
OM1950
Bookmarks