J
Josh
I have the following code for a textbox, using to validate a date:
If Me.txtPOdate > Date + 60 Then
Select Case MsgBox("Date is greater than 60 Days from today. Have you perhaps
entered an incorrect year or month? If the date is correct, click OK. If you
need to correct the date, click Cancel.", vbOKCancel Or vbQuestion Or
vbDefaultButton1, "Possible Incorrect Date Warning")
Case vbOK
'just continue on
Case vbCancel
Cancel = True
Me.txtPOdate.SelStart = 0
Me.txtPOdate.SelLength = Len(Me.txtPOdate.Text)
Exit Sub
End Select
End If
which seems to work fine. This is if user wants to type in the date. I also have
a calendar, Allen Browne's http://allenbrowne.com/ser-51.html
(I know that by using the calendar picker you mostly avoid the need for this
type of validation, but just trying to cover all my bases)
I'm trying to have the same sort of validation if user uses the calendar picker,
but I can't use the beforeupdate of txtPODate. I assume because the calendar
picker is inserting the date.
How can I have the calendar picker itself do the validating? Or some other
suggestion?
Thanks, Josh (and thanks to Allen Browne, the calendar picker works great)
If Me.txtPOdate > Date + 60 Then
Select Case MsgBox("Date is greater than 60 Days from today. Have you perhaps
entered an incorrect year or month? If the date is correct, click OK. If you
need to correct the date, click Cancel.", vbOKCancel Or vbQuestion Or
vbDefaultButton1, "Possible Incorrect Date Warning")
Case vbOK
'just continue on
Case vbCancel
Cancel = True
Me.txtPOdate.SelStart = 0
Me.txtPOdate.SelLength = Len(Me.txtPOdate.Text)
Exit Sub
End Select
End If
which seems to work fine. This is if user wants to type in the date. I also have
a calendar, Allen Browne's http://allenbrowne.com/ser-51.html
(I know that by using the calendar picker you mostly avoid the need for this
type of validation, but just trying to cover all my bases)
I'm trying to have the same sort of validation if user uses the calendar picker,
but I can't use the beforeupdate of txtPODate. I assume because the calendar
picker is inserting the date.
How can I have the calendar picker itself do the validating? Or some other
suggestion?
Thanks, Josh (and thanks to Allen Browne, the calendar picker works great)