I am trying to validate, in the after update event, an unbound form text box to make sure it is not null and has a four digit year if the default value "current year" is changed. Here is my code I have been trying but it doesn't seem to be working properly. Does anyone see what I am doing wrong? I can get it to validate if I use two separate statements however I end up with two messages which is not desired. Also is after update the appropriate place to put this and is there a better condition I can use for year. Thanks
Code:
Private Sub Year_AfterUpdate()
If Not IsNumeric(Me.Year) And Me.Year <> 4 Then
MsgBox "Please enter a four digit year."
Cancel = True
Me.Year.SetFocus
End If
End Sub