Hi there
I'm trying to prevent the user to enter a date in the future. If the date is greater than todays date the field should be cleared and have focus again.
Somehow my code is not working.
I'm trying to prevent the user to enter a date in the future. If the date is greater than todays date the field should be cleared and have focus again.
Somehow my code is not working.
Code:
Private Sub TreatmentDate_AfterUpdate()
If Me.TreatmentDate > Date Then
MsgBox "Treatment Date is in the future. Enter correct Date"
Cancel = True
Me.TreatmentDate.SetFocus
End If
End Sub