ID: 201
Viewed: 3358
Added: Apr 29, 2002
Version:
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
Check for valid 4 digit year date
Highlight all by clicking in box
<!---Declaration--->
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
End Function
Highlight All
<!---Code--->
none;
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.