Input mask for Credit Card

D

Dave

Is there any way to create a input mask to put the hyphen's between each
group of 4 numbers in a credit card field?
The added difficulty is the while most CC's have 4 groups of 4 numbers, Am
Express has 4, 4, 4 and 3



Thanks in advance
D
 
A

Allen Browne

Dave, in general, I find Input Masks to be counter-productitive. They slow
down a good data entry person; it's not easy to jump within the field, and
if you miss it character, it's not easy to insert it.

For this particular case, the problem is hightened by the fact that they are
not all 16 digits. I haven't checked recently, but Diner, JCB and
CarteBlanch used to be 14 digits, Amex was 15, and who knows what others may
be introduced in the future.

Others may have a better idea, but what I do is allow the free-form, and run
some validation in the AfterUpdate of the text box. This doesn't guarantee
the card is operational, of course, but it does catch most of the
incorrectly entered numbers. This kind of thing:
http://worldwidemart.com/scripts/readme/ccver.shtml
 
D

Dave

Allen,
Thanks for the reply.
I appreciate your input on just using a validator however I believe the user
will still prefer an imput mask.

Is there a way to do that?

Second - if I am able to perswade the used to use the valader the link you
provided to Matts scripts is for web based valadiating.
Is there such code for access (2003)?

Thanks again.
D
 
A

Allen Browne

If you wish, you can use some optional digits in the input mask. Might look
odd though.

If you can't download the code and adapt it to VBA, I can post some for you.
 
D

Dave

"If you can't download the code and adapt it to VBA, I can post some for
you"

Allen,
That would be great. (Hope it is not above my head). I am thinking I can
"sell" the user that valadation is better (more usefull) then hyphen's.

Thanks much
 
A

Allen Browne

Here it is, Dave:
http://allenbrowne.com/CCValid.html

The code referrenced some tables to verify valid ranges for the prefix
numbers too, so it ended up being more than just code. Download the sample
database and copy into your application.

All the best.
 
D

Dave

Got it working. Thanks so much.

DO you happen to know how current the algorithem is?
We are only using AmEx Visa And Master Card

Thanks again
D
 
A

Allen Browne

AFAIK, it works fine for Amex, Visa, and MasterCard.

If necessary, you can selectively choose to not apply the check sum or add
other ranges in the table.
 
D

Dave

Thank you again
D
Allen Browne said:
AFAIK, it works fine for Amex, Visa, and MasterCard.

If necessary, you can selectively choose to not apply the check sum or add
other ranges in the table.
 
Top