Number Validation
Hello,
I have this Access 2000 VBA function, can anyone tell me what it does to these numbers?? and how can i create numbers that will result to true in the function.
001574950471 001574950455 001574950463 001574950448 001574950422
Public Function ValidateAccessCard(ByRef strAccessCard As String) As Boolean
Dim intChecksum As Integer
Dim intCounter As Integer
Dim intSum As Integer
Dim intWeight As Integer
intWeight = 2
intSum = 0
intChecksum = Right(strAccessCard, 1)
strAccessCard = Left(Right(String(12, "0") + strAccessCard, 12), 11)
For intCounter = Len(strAccessCard) To 1 Step -1
intSum = CDbl(intSum) + Int((CDbl(intWeight) * Val(Mid(strAccessCard,intCounter, 1))) / CDbl(10)) + CDbl(CLng(CDbl(intWeight) * Val(Mid(strAccessCard,intCounter, 1))) Mod 10)
intWeight = -intWeight + 3
Next intCounter
ValidateAccessCard = ((10 - (intSum Mod 10)) Mod 10) = intChecksum
End Function
|