matthewnsarah07
Registered User.
- Local time
- Yesterday, 21:18
- Joined
- Feb 19, 2008
- Messages
- 192
Until now I have used this piece of validation code on my staff holiday from to validate the [Date From] field
I have now added a popup form type calendar to fill in this field, this uses an On Click event:
The problem I have is that the validation code appears to be bypassed by selecting a date from the calendar - how can I get the validation to work regardless of whether a date is typed or entered by calendar?
Thanks for your help
Code:
Private Sub Date_From_BeforeUpdate(Cancel As Integer)
If DateDiff("d", Date, Date_From) > 400 Then
MsgBox "'Date From' Cannot Be Greater Than One Year In The Future"
Cancel = True
End If
End Sub
I have now added a popup form type calendar to fill in this field, this uses an On Click event:
Code:
=CalendarFor([Date From],"Select Date From")
The problem I have is that the validation code appears to be bypassed by selecting a date from the calendar - how can I get the validation to work regardless of whether a date is typed or entered by calendar?
Thanks for your help