A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dynamic Credit Card Length



 
 
Thread Tools Display Modes
  #1  
Old August 24th, 2005, 04:37 PM
Tatakau
external usenet poster
 
Posts: n/a
Default Dynamic Credit Card Length

I have two objects on a form that I am trying to manipulate. The first is a
combo box to select a credit card type (Mastercard, Visa, Discover, Etc.).
The second is a text field to hold the actual credit card number.

In order to prevent data entry error, I have put an input mask on the text
field of 0000-0000-0000-9999. The last 4 digits are 9s (optional entry)
because one of the credit card types has only 12 digits as opposed to 16.

However, that would mean that someone could enter a 12 digit number for a
card with 16 digits, which is of course not good. Using the above input mask
is a very sloppy fix, and doesn't account for all possible entry errors. Is
there any way to dynamically change the input mask to adjust for which credit
card type is selected?

Visa, Mastercard, etc.: 0000-0000-0000-0000
Custom Card: 0000-0000-0000

Thanks,

Nick
  #2  
Old August 24th, 2005, 05:50 PM
Klatuu
external usenet poster
 
Posts: n/a
Default

You can change an input mask using VBA. You could do that in the After
Update event of your card type combo box. A trick you might try, if your
combo row source is a list, is to add a column to the list that is the input
mask for that card:
Mastercard;"0000-0000-0000-0000";Visa;"0000-0000-0000-0000";Custom;"0000-0000-0000"
Make the column width 0 so the user doesn't see it. Then in the After
Update event of the combo:
Me.txtCardNumber.InputMask = Me.cboCardType.Column(1)

"Tatakau" wrote:

I have two objects on a form that I am trying to manipulate. The first is a
combo box to select a credit card type (Mastercard, Visa, Discover, Etc.).
The second is a text field to hold the actual credit card number.

In order to prevent data entry error, I have put an input mask on the text
field of 0000-0000-0000-9999. The last 4 digits are 9s (optional entry)
because one of the credit card types has only 12 digits as opposed to 16.

However, that would mean that someone could enter a 12 digit number for a
card with 16 digits, which is of course not good. Using the above input mask
is a very sloppy fix, and doesn't account for all possible entry errors. Is
there any way to dynamically change the input mask to adjust for which credit
card type is selected?

Visa, Mastercard, etc.: 0000-0000-0000-0000
Custom Card: 0000-0000-0000

Thanks,

Nick

  #3  
Old August 24th, 2005, 05:55 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

Input masks are not very useful.

Use the BeforeUpdate event of the *form* to perform the validation on the
Len() of the field.

--
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.

"Tatakau" wrote in message
...
I have two objects on a form that I am trying to manipulate. The first is
a
combo box to select a credit card type (Mastercard, Visa, Discover, Etc.).
The second is a text field to hold the actual credit card number.

In order to prevent data entry error, I have put an input mask on the text
field of 0000-0000-0000-9999. The last 4 digits are 9s (optional entry)
because one of the credit card types has only 12 digits as opposed to 16.

However, that would mean that someone could enter a 12 digit number for a
card with 16 digits, which is of course not good. Using the above input
mask
is a very sloppy fix, and doesn't account for all possible entry errors.
Is
there any way to dynamically change the input mask to adjust for which
credit
card type is selected?

Visa, Mastercard, etc.: 0000-0000-0000-0000
Custom Card: 0000-0000-0000

Thanks,

Nick



  #4  
Old August 24th, 2005, 06:10 PM
Klatuu
external usenet poster
 
Posts: n/a
Default

Allen,
Your comment on Input Masks suprises me. In most instances they are not
necessary, but for cases like this, phone numbers, or other data that needs
to be in a specific format, I find them useful.
I would consider this situation the perfect place to use an input mask;
otherwise, you would have write code to check the length of the entry against
the length required by the card issuer and ensure it is numeric data. You
would also have to determine whether any - characters are entered and whether
you want to store them in the data base. This very simple input mask
resolves those issues.

"Allen Browne" wrote:

Input masks are not very useful.

Use the BeforeUpdate event of the *form* to perform the validation on the
Len() of the field.

--
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.

"Tatakau" wrote in message
...
I have two objects on a form that I am trying to manipulate. The first is
a
combo box to select a credit card type (Mastercard, Visa, Discover, Etc.).
The second is a text field to hold the actual credit card number.

In order to prevent data entry error, I have put an input mask on the text
field of 0000-0000-0000-9999. The last 4 digits are 9s (optional entry)
because one of the credit card types has only 12 digits as opposed to 16.

However, that would mean that someone could enter a 12 digit number for a
card with 16 digits, which is of course not good. Using the above input
mask
is a very sloppy fix, and doesn't account for all possible entry errors.
Is
there any way to dynamically change the input mask to adjust for which
credit
card type is selected?

Visa, Mastercard, etc.: 0000-0000-0000-0000
Custom Card: 0000-0000-0000

Thanks,

Nick




  #5  
Old August 24th, 2005, 06:15 PM
Tatakau
external usenet poster
 
Posts: n/a
Default

Perfect! I was thinking I'd have to write code like "after update, if
cardtype = Mastercard then inputmask = '0000-0000-0000-0000'"... your
solution is much more clever! Thanks!

Nick

"Klatuu" wrote:

You can change an input mask using VBA. You could do that in the After
Update event of your card type combo box. A trick you might try, if your
combo row source is a list, is to add a column to the list that is the input
mask for that card:
Mastercard;"0000-0000-0000-0000";Visa;"0000-0000-0000-0000";Custom;"0000-0000-0000"
Make the column width 0 so the user doesn't see it. Then in the After
Update event of the combo:
Me.txtCardNumber.InputMask = Me.cboCardType.Column(1)

"Tatakau" wrote:

I have two objects on a form that I am trying to manipulate. The first is a
combo box to select a credit card type (Mastercard, Visa, Discover, Etc.).
The second is a text field to hold the actual credit card number.

In order to prevent data entry error, I have put an input mask on the text
field of 0000-0000-0000-9999. The last 4 digits are 9s (optional entry)
because one of the credit card types has only 12 digits as opposed to 16.

However, that would mean that someone could enter a 12 digit number for a
card with 16 digits, which is of course not good. Using the above input mask
is a very sloppy fix, and doesn't account for all possible entry errors. Is
there any way to dynamically change the input mask to adjust for which credit
card type is selected?

Visa, Mastercard, etc.: 0000-0000-0000-0000
Custom Card: 0000-0000-0000

Thanks,

Nick

  #6  
Old August 24th, 2005, 06:33 PM
Allen Browne
external usenet poster
 
Posts: n/a
Default

In general, input masks have more downsides than positives, such as the
inability to insert a missed digit.

In particular, the number of digits varies beyond the 2 values the OP
suggested, e.g. Visa can be 13, Diner can be 14, AmEx can be 15. Further,
these could change in the future, so hard-coding rules is not a good idea.

A better solution is to create a table of the card types to be handled, and
a related table of the prefix ranges for each card, with the number of
digits required for the prefix range, and whether to use the checksum
algorithm as per:
http://www.scriptarchive.com/ccver.html

We are well outside the capabilities of an input mask here.

--
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.

"Klatuu" wrote in message
...
Allen,
Your comment on Input Masks suprises me. In most instances they are not
necessary, but for cases like this, phone numbers, or other data that
needs
to be in a specific format, I find them useful.
I would consider this situation the perfect place to use an input mask;
otherwise, you would have write code to check the length of the entry
against
the length required by the card issuer and ensure it is numeric data. You
would also have to determine whether any - characters are entered and
whether
you want to store them in the data base. This very simple input mask
resolves those issues.

"Allen Browne" wrote:

Input masks are not very useful.

Use the BeforeUpdate event of the *form* to perform the validation on the
Len() of the field.

"Tatakau" wrote in message
...
I have two objects on a form that I am trying to manipulate. The first
is
a
combo box to select a credit card type (Mastercard, Visa, Discover,
Etc.).
The second is a text field to hold the actual credit card number.

In order to prevent data entry error, I have put an input mask on the
text
field of 0000-0000-0000-9999. The last 4 digits are 9s (optional
entry)
because one of the credit card types has only 12 digits as opposed to
16.

However, that would mean that someone could enter a 12 digit number for
a
card with 16 digits, which is of course not good. Using the above
input
mask
is a very sloppy fix, and doesn't account for all possible entry
errors.
Is
there any way to dynamically change the input mask to adjust for which
credit
card type is selected?

Visa, Mastercard, etc.: 0000-0000-0000-0000
Custom Card: 0000-0000-0000



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Version 8 Integration for SOP does not pick up the credit card specified in the source field it uses the default credit card against the debtor. Jen General Discussion 1 September 14th, 2005 03:17 AM
credit card number security jeffh General Discussion 4 May 12th, 2005 03:55 AM
REAL CREDIT CARD NUMBERS HACK!! Dirk Goldgar General Discussion 14 November 20th, 2004 11:09 AM
Credit Card Character Count AL V Running & Setting Up Queries 1 June 30th, 2004 06:48 PM
Credit Card Number Suppression Dana Worksheet Functions 7 November 10th, 2003 10:01 PM


All times are GMT +1. The time now is 06:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.