Credit Card Validation

  • Thread starter Thread starter Harold
  • Start date Start date
H

Harold

Using XP and trying to validate the various credit cards
on a form. I've seen through another Access program that
if the number is not a valid number, it'll tell you right
away.

Thanks
 
As far as I know, Access does not have built-in credit card validation
capabilities. It is possible that the other program you saw makes use of an
add-in specially written to do this. You can do a search at
http://www.google.com using the following as a search criterion:

access add-in for credit card validation

and get many 'hits' to evaluate for use in your program.
 
Search for "Credit Card" at www.planet-source-code.com.


--
Jim Carlock
http://www.microcosmotalk.com/
Post replies to the newsgroup.


As far as I know, Access does not have built-in credit card validation
capabilities. It is possible that the other program you saw makes use of an
add-in specially written to do this. You can do a search at
http://www.google.com using the following as a search criterion:

access add-in for credit card validation

and get many 'hits' to evaluate for use in your program.
 
Harold said:
Using XP and trying to validate the various credit cards
on a form. I've seen through another Access program that
if the number is not a valid number, it'll tell you right
away.

Here's some code posted in an Access newsgroup several years ago. I
personally have not checked it for accuracy, nor do I have the name of
whomever posted it:

Validating a Credit Card Number The following function will return true or
false depending whether or not a credit card is valid.

NOTE: This code will only tell you if the number entered is valid for a
credit card, not if the actual card itself is valid.

Function CheckCard(CCNumber As String) As Boolean
Dim Counter As Integer, TmpInt As Integer
Dim Answer As Integer
Counter = 1
TmpInt = 0

While Counter <= Len(CCNumber)
If IsEven(Len(CCNumber)) Then
TmpInt = Val(Mid$(CCNumber, Counter, 1))
If Not IsEven(Counter) Then
TmpInt = TmpInt * 2
If TmpInt > 9 Then TmpInt = TmpInt - 9
End If
Answer = Answer + TmpInt
Counter = Counter + 1
Else
TmpInt = Val(Mid$(CCNumber, Counter, 1))
If IsEven(Counter) Then
TmpInt = TmpInt * 2
If TmpInt > 9 Then TmpInt = TmpInt - 9
End If
Answer = Answer + TmpInt
Counter = Counter + 1
End If
Wend
Answer = Answer Mod 10
If Answer = 0 Then CheckCard = True
End Function

Function IsEven ( plngValue As Long ) As Boolean
IsEven = ((plngValue MOD 2) = 0)
End Function
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top