Lynn_AccessUser
Registered User.
- Local time
- Today, 08:59
- Joined
- Feb 4, 2003
- Messages
- 125
I am trying to set validation on a date field as follows:
If DateField > Now() Then
Msgbox "You can not enter in a date greater than today's date."
End If
I would like the code to then delete whatever value the user entered and set the focus back to that field.
I have tried the above code as is on the before update, after update, on change, on enter, on got focus, and on lost focus events. Problem is that the user get the msgbox but then after they hit OK it tabs to the next field leaving the data as is in the date field so the invalid date gets saved once the record is closed.
If DateField > Now() Then
Msgbox "You can not enter in a date greater than today's date."
End If
I would like the code to then delete whatever value the user entered and set the focus back to that field.
I have tried the above code as is on the before update, after update, on change, on enter, on got focus, and on lost focus events. Problem is that the user get the msgbox but then after they hit OK it tabs to the next field leaving the data as is in the date field so the invalid date gets saved once the record is closed.