Credit Card & SIN Number Validation

Category:
Office/VBA
Type:
Snippets
Difficulty:
Intermediate

Author: Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5, Visual Basic.NET

More information:
Although there are numerous versions of this validation routine on this site, this one is uses current card carrier information and is all-encompassing. It: a) checks ALL (Credit,debit,Airline,etc) cards using the LUHN algorithm b) checks whether the first four digits are valid for that specific card carrier (i.e. Visa, MasterCard, AMEX, etc) c) and, checks the validity of a Canadian Social Insurance Number (SIN) d) makes use of an ENUM of all valid card carriers to ease the function deployment in other modules e) Optionally, returns the appropriate name for the Card f) describes (in simple terms) how the LUHN algorithm works f) is relatively well documented Do not let the length of the function deter you; 80% of it is doumentation

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: