Date field exception to the rule
Posted on 2007-11-14
I have a before update code that works fine but now, I will like to create an exception to the rule.
txtAppDate is a date field used in setting date range for number of record generated monthly.
If a record is cancelled, then I want to update tblMain.Appdate to an invalid date like 99\99\99 such that this date can never be utilized for counting records monthly.
At the form level, my before update event code might present a dilemma when user navigates to the record containing the invalid date. Looking at the code, is there any way to set an exception to an invalid date 99\99\99 for example such that the before update code ignores the entry when user navigates to the cancelled record?
However, I still want the before update code to function as it was originally designed for users wanting to validate new date entry. I am not sure this is possible - I just want to explore the possibility.
Before update event of the control
If Me.txtAppdate > Date() Then
Msgbox "The date you entered is not valid", , "Bad Date"
Cancel = True