Home » Microsoft Access » 08 - Data Validation
8

Input Mask

The first type of field level data validation is the input mask.

  1. It specifies how data is entered and displayed. For example, if you set this property to 000-00-0000, hyphens are displayed as shown, and an underscore(_) is displayed in place of each zero. At the time of data entry it will be displayed as _ _ _- _ _ - _ _ .
  2. The setting can contain up to three parts separated by semicolons (for example, (999) 000-0000! ; 0 ; “ “):
    • The first part specifies the input mask itself (for example (999) 000-0000!).
    • The second part specifieswhether MicrosoftAccess stores the literal display characters in the table when you enter data. If you use 0 for this part, all literal display characters are stored with the value and if you enter 1 or leave this part blank, only characters typed into the text box are stored.
    • The third part specifies the character that Microsoft Access displays for spaces in the input Mask. You can also use any character to display a space, or use a space enclosed in quotation marks (“ “).

Activity: In an institute the batch numbers are in the format ECT-01-01, DTG-44-13, and etc. where the first three letters signify the course code, the two digits after the first hyphen signify the year code and the last two digits signify the batch serial number. Frame an Input Mask for the above format. The course code of three letters and year code of two letters are a must. The batch serial number can have one or two digits. The batch numbers entered must be stored in the same format as they are displayed and the mask should display ~ to show a space.

  • For letters that must be entered, code L is used and for digit that must be entered code 0(zero) is used.
  • For optional digits,code 9 is used.
  • Hence the input mask for the above specified criteria would be LLL-00-09, the complete input mask specification for batch numbers will be LLL-00-09; 0 ;~