Input Mask Help

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

Hi All,

I am storing Credit Card numbers (until process then they are deleted).
However I'd like to have the dash's to seperate the numbers. VISA and MC seem
to be the same 16 digits however AMEX is 15. How can I have different Input
masks for different card types and store the data in the same field?

Matt
 
M

Mr. B

Hi, Matt,

I would assume that you have a combo box where your users can select the
type of card that they are using. You would need to place code in the After
Update event of that combo box that would set the Input Mask based on the
card type that was selected.

You coudl use an If statement or a Case statement to make the decision of
which Input Mask to assign to your text box.
 
M

mattc66 via AccessMonster.com

What would be the code for an input mask?

Mr. B said:
Hi, Matt,

I would assume that you have a combo box where your users can select the
type of card that they are using. You would need to place code in the After
Update event of that combo box that would set the Input Mask based on the
card type that was selected.

You coudl use an If statement or a Case statement to make the decision of
which Input Mask to assign to your text box.

-----
HTH
Mr. B
askdoctoraccess dot com
[quoted text clipped - 4 lines]
 
M

Mr. B

Matt,

Use the following code in the AfterUpdate event of your combo box where the
type of card is to be selected:

With Me.txtCardNumber
'clear any values in the text box
.Value = ""
'set the input mask
If Me.cboCardType = "Visa" Then
.InputMask = "0000\-0000\-0000\-000"
Else
.InputMask = "0000\-0000\-0000\-0000"
End If
'set focus to the text box for data entry
.SetFocus
End With

This code is setup for a 15 character entry in the text box when Visa is
selected and 16 characters when anything else is selected.

You can modify this code to accomodiate any other input mask definition.

-----
HTH
Mr. B
askdoctoraccess dot com


mattc66 via AccessMonster.com said:
What would be the code for an input mask?

Mr. B said:
Hi, Matt,

I would assume that you have a combo box where your users can select the
type of card that they are using. You would need to place code in the After
Update event of that combo box that would set the Input Mask based on the
card type that was selected.

You coudl use an If statement or a Case statement to make the decision of
which Input Mask to assign to your text box.

-----
HTH
Mr. B
askdoctoraccess dot com
[quoted text clipped - 4 lines]
 
M

mattc66 via AccessMonster.com

Thanks that worked great.

Mr. B said:
Matt,

Use the following code in the AfterUpdate event of your combo box where the
type of card is to be selected:

With Me.txtCardNumber
'clear any values in the text box
.Value = ""
'set the input mask
If Me.cboCardType = "Visa" Then
.InputMask = "0000\-0000\-0000\-000"
Else
.InputMask = "0000\-0000\-0000\-0000"
End If
'set focus to the text box for data entry
.SetFocus
End With

This code is setup for a 15 character entry in the text box when Visa is
selected and 16 characters when anything else is selected.

You can modify this code to accomodiate any other input mask definition.

-----
HTH
Mr. B
askdoctoraccess dot com
What would be the code for an input mask?
[quoted text clipped - 18 lines]
 

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