Credit Card Character Count

  • Thread starter Thread starter AL V
  • Start date Start date
A

AL V

I have a webstore that collects credit card info from
people buying our product. I do not have Credit Card
validation yet on the Webstore. What I do is collect the
info in Access and then link Access to my internal
Sales/Accounting system. How can I, in a query, limit the
entries to only those who give me a 16 character credit
card number. The credit card # comes in all varieties and
shapes... with dashes, no spaces, spaces.. I want to just
count the characters that are numbers.

Thanks in advance.

Al
 
I have a webstore that collects credit card info from
people buying our product. I do not have Credit Card
validation yet on the Webstore. What I do is collect the
info in Access and then link Access to my internal
Sales/Accounting system. How can I, in a query, limit the
entries to only those who give me a 16 character credit
card number. The credit card # comes in all varieties and
shapes... with dashes, no spaces, spaces.. I want to just
count the characters that are numbers.

You'll need a bit of a VBA function to do this. Off the top of my
head, air code, untested:

Public Function JustDigits(strIn As String) As String
Dim iPos As Integer
For iPos = 1 to Len(strIn)
If IsNumeric(Mid(strIn, iPos, 1) Then
JustDigits = JustDigits & Mid(strIn, iPos, 1)
End If
Next iPos
End Function

Check the Len() of JustDigits([CCNO]) in your query.
 
Back
Top