Credit Card Imput Mask

Rich1968

Registered User.
Local time
Today, 08:50
Joined
Jan 24, 2003
Messages
57
I accept Credit Cards Over the Phone. I send a receipt to the Customer with the entire CC Number xxx Out. I want to set up an Input mask in my receipt report that will only x out the first 12 numbers. Like this:

XXXX-XXXX-XXXX-9999

I have try several times to accomplish this.

Any help would be appreciate!

Rich
 
I believe this is posted in the wrong forum.

What you are looking for is not an Input Mask, but rather a how the data looks on a report. When the user inputs the CC #, they will need to see the entire number. Try this ... Let's assume the field where the CC # is stored is called CC_Num. In the control source of a text box on a report, have:

="XXXX-XXXX-XXXX-" & Right([CC_Num],4)

On the input form you can have an Input Mask of something like:

0000\-0000\-0000\-0000;1;#

This will ensure that you input all of the numbers required.
 
Last edited:
Hey PDX,

Thanks for the help! It worked great!

Rich :D
 
Err, I also have somewhere a credit card NUMBER validating routine, it's only for checking that the number could be a credit card number, it dosen't know if its stolen!!!

If you want it I'll post it, (If I can find it)
 
Validating Credit Card Numbers

I found the following on the web several years ago, I've never used it, its in VB6 so you may need to modifiy it sligtly.

Can be found at http://www.developer.com/net/vb/article.php/1542021
credited to Sam Huggill

Tony....

Extract:::::::::::::::::::::::::::::::::
Validating Credit Card Numbers

If the number is in a valid format if returns 'True'. If the number is in an invalid format it returns 'False'. This algorithm should work with all credit cards. If a card validates with this code it doesn't mean that the card is actually good, it just means that the numbers are arranged in a valid format. If they don't validate then you've saved some time because you don't have to process the card to find out that it is definitely bad. I use this function in CGI forms that process credit card orders.

Code:
Code

Function CheckCard(CCNumber As String) As Boolean
    Dim Counter As Integer, TmpInt As Integer
    Dim Answer As Integer

    Counter = 1
    TmpInt = 0

    While Counter <= Len(CCNumber)
        If IsEven(Len(CCNumber)) Then
            TmpInt = Val(Mid$(CCNumber, Counter, 1))
            If Not IsEven(Counter) Then
                TmpInt = TmpInt * 2
                If TmpInt > 9 Then TmpInt = TmpInt - 9
            End If
            Answer = Answer + TmpInt
            'Debug.Print Counter, TmpInt, Answer
            Counter = Counter + 1
        Else
            TmpInt = Val(Mid$(CCNumber, Counter, 1))
            If IsEven(Counter) Then
                TmpInt = TmpInt * 2
                If TmpInt > 9 Then TmpInt = TmpInt - 9
            End If
            Answer = Answer + TmpInt
            'Debug.Print Counter, TmpInt, Answer
            Counter = Counter + 1
        End If
    Wend

    Answer = Answer Mod 10

    If Answer = 0 Then CheckCard = True
End Function

Function IsEven(lngNumber As Long) As Boolean

If lngNumber Mod 2 = 0 Then
  IsEven = True
Else
  IsEven = False
End If

End Function

credited to Sam Huggill
 
Last edited:
Determining Credit Card Types

Same again not mine! And I haven't used it, it's VB6 again should just drop in to access but there are some differences between Access and VB6 so you may have to do some conversion...

TO: Originally found at: http://www.vbworld.com/misc/tip509.html, but now available at http://www.developer.com/net/vb



Extract ::::::::::::::::::::::::::::::::::::::
Determining Credit Card Types

Need to determine a credit card type? Can't be bothered to write your own decision-making function?

Fear not - hear to help is our own ready-to-run code snippet. Just feed it a credit card number and it'll return a string of the appropriate card type.

If you want to determine whether a credit card number is valid, check out our handy code snippet here.

Usage

x = CreditCardType("5454 1234 4321 1234")
Code

Code:
Public Function CreditCardType(ByVal CardNo As String) As String

'*CARD TYPES            *PREFIX           *WIDTH
'American Express       34, 37            15
'Diners Club            300 to 305, 36    14
'Carte Blanche          38                14
'Discover               6011              16
'EnRoute                2014, 2149        15
'JCB                    3                 16
'JCB                    2131, 1800        15
'Master Card            51 to 55          16
'Visa                   4                 13, 16
    
'Just in case nothing is found
CreditCardType = "Unknown"

'Remove all spaces and dashes from the passed string
CardNo = Replace(Replace(CardNo, " ", ""), "-", "")

'Check that the minimum length of the string isn't less
'than fourteen characters and -is- numeric
If Len(CardNo) < 14 Or Not IsNumeric(CardNo) Then Exit Function

'Check the first two digits first
Select Case CInt(Left(CardNo, 2))
   Case 34, 37
      CreditCardType = "American Express"
   Case 36
      CreditCardType = "Diners Club"
   Case 38
      CreditCardType = "Carte Blanche"
   Case 51 To 55
      CreditCardType = "Master Card"
   Case Else

      'None of the above - so check the
	  'first four digits collectively
      Select Case CInt(Left(CardNo, 4))
	  
         Case 2014, 2149
            CreditCardType = "EnRoute"
         Case 2131, 1800
            CreditCardType = "JCB"
         Case 6011
            CreditCardType = "Discover"
         Case Else

            'None of the above - so check the
            'first three digits collectively
            Select Case CInt(Left(CardNo, 3))
               Case 300 To 305
                  CreditCardType = "American Diners Club"
               Case Else
         
               'None of the above -
               'so simply check the first digit
               Select Case CInt(Left(CardNo, 1))
                  Case 3
                     CreditCardType = "JCB"
                  Case 4
                    CreditCardType = "Visa"
               End Select

            End Select
			
      End Select
	  
End Select

End Function

Tip by Karl Moore
 
Last edited:
Further to the Above Listings. I tracked down the author and received the following reply:-

You should actually get permission before posting articles from other sites; otherwise, it is a copyright violation.

One of the tips you posted can be found at http://www.developer.com/net/vb/article.php/1542021
This should actually be credited to Sam Huggill rather than Karl. If you add the above link to Developer.com and credit Sam, then I'll be okay with your posting (keep this email).

On the second one, please change

Found at: http://www.vbworld.com/misc/tip509.html alas 404 message again....

TO: Originally found at: http://www.vbworld.com/misc/tip509.html, but now available at http://www.developer.com/net/vb

Thanks,

Brad Jones
Executive Editor
Developer.com / Jupitermedia

-----Original Message-----
From: jwfeedsw@jupitermedia.com [mailto:jwfeedsw@jupitermedia.com]
Sent: Monday, May 03, 2004 6:30 PM
To: jwfeedsw@jupitermedia.com
Subject: I posted a tip by Karl Moore


Here is the result of your feedback form. It was submitted by Tony Hine (walter.tower@lycos.co.uk) on Monday, May 3, 2004 at 19:30:09
---------------------------------------------------------------------------

url: http://www.developer.com/net/vb/article.php/1538761

Comments: I did a google for "Karl Moore" and found this site.

I posted a tip by Karl Moore here:

http://www.access-programmers.co.uk/forums/showthread.php?p=278744#post27874
4
And I thought I ought to try to get his permission for posting the tip. Please let me know if you have a problem with this.
 

Users who are viewing this thread

Back
Top Bottom