Date Validation Function (with object passed):   Return to List

Public Function ScanThisDate(ByVal objMyTextbox As Object) As Boolean On Error GoTo BYE
If Len(objMyTextbox.Text) > 0 Then
    If IsDate(objMyTextbox.Text) = False Then
        objMyTextbox.Text = vbNullString
        objMyTextbox.SetFocus
        MsgBox "Date is NOT VALID!" & vbCrLf & vbCrLf & _
                "Please CORRECT and Try Again.", vbOKOnly, _
                "Conversion Date Error"
        ScanThisDate = False
        Exit Function
    End If
End If
ScanThisDate = True
BYE:
End Function



Note to Webmaster