Added: Apr 29, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Check for valid 4 digit year date
Highlight all by clicking in box
Public Function ValidDate(MDate)
'Purpose: Check for 4 digit yyyy DATE
'Input: String from text box
'Output: True or False
'Default is false
ValidDate = False
'Exit if length less than "m/d/yyyy"
If Len(MDate) < 8 Then Exit Function
'Exit if not a valid date wrong
If IsDate(MDate) = False Then Exit Function
'Exit if not ending or starting with "yyyy"
Dim StartDate As String
Dim EndDate As String
EndDate = Right(MDate, 4)
StartDate = Left(MDate, 4)
If ValidChar(EndDate, "0123456789") = False And _
ValidChar(StartDate, "0123456789") = False Then Exit Function
'Set to true if it passes all these tests!
ValidDate = True
No Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.