Credit Card Character Count

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
 
J

John Vinson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top