MS Access Forum / Forms / July 2007
Input mask for Credit Card
|
|
Thread rating:  |
Dave - 14 Jul 2007 05:26 GMT 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
Allen Browne - 14 Jul 2007 05:53 GMT 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
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> 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? [quoted text clipped - 3 lines] > Thanks in advance > D Dave - 14 Jul 2007 16:45 GMT 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
> 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 [quoted text clipped - 18 lines] >> Thanks in advance >> D Allen Browne - 14 Jul 2007 18:15 GMT 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.
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> Allen, > Thanks for the reply. [quoted text clipped - 28 lines] >>> The added difficulty is the while most CC's have 4 groups of 4 numbers, >>> Am Express has 4, 4, 4 and 3 Dave - 14 Jul 2007 18:44 GMT "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
> If you wish, you can use some optional digits in the input mask. Might > look odd though. [quoted text clipped - 34 lines] >>>> The added difficulty is the while most CC's have 4 groups of 4 numbers, >>>> Am Express has 4, 4, 4 and 3 Allen Browne - 15 Jul 2007 06:35 GMT 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.
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> "If you can't download the code and adapt it to VBA, I can post some for > you" [quoted text clipped - 42 lines] >>>>> The added difficulty is the while most CC's have 4 groups of 4 >>>>> numbers, Am Express has 4, 4, 4 and 3 Dave - 16 Jul 2007 03:01 GMT 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
> Here it is, Dave: > http://allenbrowne.com/CCValid.html [quoted text clipped - 51 lines] >>>>>> The added difficulty is the while most CC's have 4 groups of 4 >>>>>> numbers, Am Express has 4, 4, 4 and 3 Allen Browne - 16 Jul 2007 11:27 GMT 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.
 Signature Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org.
> Got it working. Thanks so much. > [quoted text clipped - 58 lines] >>>>>>> The added difficulty is the while most CC's have 4 groups of 4 >>>>>>> numbers, Am Express has 4, 4, 4 and 3 Dave - 16 Jul 2007 16:18 GMT Thank you again D
> AFAIK, it works fine for Amex, Visa, and MasterCard. > [quoted text clipped - 65 lines] >>>>>>>> The added difficulty is the while most CC's have 4 groups of 4 >>>>>>>> numbers, Am Express has 4, 4, 4 and 3
|
|
|