- Home
·
- Miscellaneous
·
- Validates a check routing number and returns true or false depending on the validation of the reout
Validates a check routing number and returns true or false depending on the validation of the reout
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
(1(1 Vote))
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
Validates a check routing number and returns true or false depending on the validation of the reout Comments
No comments yet — be the first to post one!
Post a Comment