Not a Member Yet,
Click here to Register
How do you like the new design?

ID: 201
Viewed: 2788
Added: Apr 29, 2002
Snippet uploaded by: snippet
Written By: unknown
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

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
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

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

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.

© 2002 - 2017 All Rights Reserved. Conditions