Date Validation. If any simple code is available please do mail me.
Date Validation. If any simple code is available please do mail me.
API Declarations
Dim sDate As String
Rate Date Validation. If any simple code is available please do mail me.
(2(2 Vote))
// Add to the user control form.
// Note:This can be done without the user control but it will useful once
// you create User control.
Private Sub MaskEdBox1_LostFocus()
sDate = MaskEdBox1.Text
If IsDate(sDate) = False Then
MaskEdBox1.SetFocus
Exit Sub
Else
iYear = Mid(sDate, 7, 4)
If Mid(sDate, 1, 2) <= 0 Or Mid(sDate, 1, 2) > 12 Then
MsgBox "Enter Months Between 1 TO 12"
End If
If Mid(sDate, 1, 2) = 1 Or Mid(sDate, 1, 2) = 3 Or Mid(sDate, 1, 2) = 5 Or Mid(sDate, 1, 2) = 7 Or Mid(sDate, 1, 2) = 8 Or Mid(sDate, 1, 2) = 10 Or Mid(sDate, 1, 2) = 12 Then
If Mid(sDate, 4, 2) <= 0 Or Mid(sDate, 4, 2) > 31 Then
MsgBox "Enter Days Between 1 TO 31"
End If
Else
if Mid(sDate, 1, 2) = 4 Or Mid(sDate, 1, 2) = 6 Or Mid(sDate, 1, 2)= 9 Or Mid(sDate, 1, 2) = 11 Then
If Mid(sDate, 4, 2) <= 0 Or Mid(sDate, 4, 2) > 30 Then
MsgBox "Enter Days Between 1 TO 30"
End If
Else
If Mid(sDate, 1, 2) = 2 And (iYear Mod 4 = 0) Then
If Mid(sDate, 4, 2) <= 0 Or Mid(sDate, 4, 2) > 28 Then
' MsgBox "Enter Days Between 1 TO 28"
End If
Else
'MsgBox "Enter Days Between 1 TO 28"
End If
End If
End If
End If
end sub
Date Validation. If any simple code is available please do mail me. Comments
No comments yet — be the first to post one!
Post a Comment