M
mattc66 via AccessMonster.com
Hi All,
I found this function on the web and I want to incorporate this into my
database to check the entry of credit card numbers. How would I add this
function to my form?
Public Function Mod10Check(sNum As String) As Boolean
' Check a credit card number using mod10
Dim i, iDigit, iTotal, iDoubleFlag As Integer
For i = Len(sNum) To 1 Step -1
iDigit = Asc(Mid$(sNum, i, 1)) - 48
If iDigit < 0 Or iDigit > 9 Then
Mod10Check = False
Exit Function
End If
If iDoubleFlag Then
iDigit = iDigit + iDigit
If iDigit > 9 Then iDigit = iDigit - 9
iDoubleFlag = False
Else
iDoubleFlag = True
End If
iTotal = iTotal + iDigit
Next
Mod10Check = (iTotal Mod 10 = 0)
End Function
I found this function on the web and I want to incorporate this into my
database to check the entry of credit card numbers. How would I add this
function to my form?
Public Function Mod10Check(sNum As String) As Boolean
' Check a credit card number using mod10
Dim i, iDigit, iTotal, iDoubleFlag As Integer
For i = Len(sNum) To 1 Step -1
iDigit = Asc(Mid$(sNum, i, 1)) - 48
If iDigit < 0 Or iDigit > 9 Then
Mod10Check = False
Exit Function
End If
If iDoubleFlag Then
iDigit = iDigit + iDigit
If iDigit > 9 Then iDigit = iDigit - 9
iDoubleFlag = False
Else
iDoubleFlag = True
End If
iTotal = iTotal + iDigit
Next
Mod10Check = (iTotal Mod 10 = 0)
End Function