'*************************************************************** ' Name: Credit Card Checksum Checker ' Description:Checks to see if a Credit Card Number is valid by p ' erforming the LUHN-10 check on it. ' By: John Anderson ' ' ' Inputs:CCNum as String ' ' Returns:True if Valid, False if Invalid ' 'Assumes:None ' 'Side Effects:May cause skin irritation ' 'Warranty: 'Code provided by Planet Source Code(tm) (http://www.Planet-Sourc ' e-Code.com) 'as is', without warranties as to performance, fitnes ' s, merchantability,and any other warranty (whether expressed or i ' mplied). 'Terms of Agreement: 'By using this source code, you agree to the following terms... ' 1) You may use this source code in personal projects and may co ' mpile it into an .exe/.dll/.ocx and distribute it in binary forma ' t freely and with no charge. ' 2) You MAY NOT redistribute this source code (for example to a ' web site) without written permission from the original author.Fai ' lure to do so is a violation of copyright laws. ' 3) You may link to this code from another website, provided it ' is not wrapped in a frame. ' 4) The author of this code may have retained certain additional ' copyright rights.If so, this is indicated in the author's descrip ' tion. '*************************************************************** Public Function IsValidCCNum(CCNum As String) As Boolean Dim i As Integer Dim total As Integer Dim TempMultiplier As String For i = Len(CCNum) To 2 Step -2 total = total + CInt(Mid$(CCNum, i, 1)) TempMultiplier = CStr((Mid$(CCNum, i - 1, 1)) * 2) total = total + CInt(Left$(TempMultiplier, 1)) If Len(TempMultiplier) > 1 Then total = total + CInt(Right$(TempMultiplier, 1)) Next If Len(CCNum) Mod 2 = 1 Then total = total + CInt(Left$(CCNum, 1)) If total Mod 10 = 0 Then IsValidCCNum = True Else IsValidCCNum = False End If End Function