• 512-991-7197
  • This email address is being protected from spambots. You need JavaScript enabled to view it.
  • Always Open

Welcome to Microsoft Access Tips & Tricks

Credit Card validation

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

This sample database (Access 2000 and later, 30kb zipped) performs check sum validation for credit cards, verifying:

  • The first four digits are correct for the type of card
  • The correct number of digits have been entered
  • The check sum of the digits yields a correct result

It does NOT connect or obtain approval for the transaction. There is no guarantee that a valid card number is a real account, nor that there are any funds in the account. It merely catches data entry errors that could not be a valid credit card number.

To use this in your database:

  1. Import the two tables, sample form, and module into your database.
  2. Table ltCardType lists credit card types (Visa, MasterCard, etc.) Check the Inactive box for cards you do not handle.
  3. Table ltCardValid lists the valid prefix ranges, the number of digits expected for each type of card, and whether to call the check sum routine.
  4. Form frmCCExample is unbound - an example of how to set up your form. Copy the code for the CardType and CardNum controls.

The code and the data (list of cards and prefixes) is from an old database, so you may need to adjust it for newer card types or prefix ranges. Just add, remove or edit the records in table ltCardValid.

The code ignores any non-digits in the card number (spaces, hyphens, etc.)

Recommend other relevant articles:



© 2019 Austin Laptop [AustinLaptop.Com]. All Rights Reserved.