VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Validates a check routing number and returns true or false depending on the validation of the reout

by Daniel S Boucher (4 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 16th May 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Validates a check routing number and returns true or false depending on the validation of the reouting number

Rate Validates a check routing number and returns true or false depending on the validation of the reout



On Error GoTo HandleErr
Dim iMatch As Long
Dim lngCheckSum As Long
Dim intLoop As Long
    
    If Len(strNo) <> 9 Then
        CheckRouting = False
        Exit Function
    End If
    
    lngCheckSum = 0
    For intLoop = 1 To 9
    Select Case (intLoop - 1) Mod 3
        Case 0: lngCheckSum = lngCheckSum + (Val(Mid$(strNo, intLoop, 1)) * 3)
        Case 1: lngCheckSum = lngCheckSum + (Val(Mid$(strNo, intLoop, 1)) * 7)
        Case 2: lngCheckSum = lngCheckSum + (Val(Mid$(strNo, intLoop, 1)) * 1)
    End Select
    Next intLoop
        
    If lngCheckSum Mod 10 <> 0 Then ' not a multiple of 10
        CheckRouting = False
    Else
        CheckRouting = True
        Exit Function
    End If

    
exithere:
    Exit Function

' Error handling block added by Error Handler Add-In. DO NOT EDIT this block of code.
' Automatic error handler last updated at 07-11-2001 17:08:49   'ErrorHandler:$$D=07-11-2001    'ErrorHandler:$$T=17:08:49
HandleErr:
    Select Case Err.Number
        Case Else
            MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical, "modEFG.CheckRouting"    'ErrorHandler:$$N=modEFG.CheckRouting
    End Select
' End Error handling block.
End Function

Download this snippet    Add to My Saved Code

Validates a check routing number and returns true or false depending on the validation of the reout Comments

No comments have been posted about Validates a check routing number and returns true or false depending on the validation of the reout. Why not be the first to post a comment about Validates a check routing number and returns true or false depending on the validation of the reout.

Post your comment

Subject:
Message:
0/1000 characters