How to Create Input Masks in Microsoft Access on Windows 11
Posted on 15th June 2023
Introduction
An input mask is a string of characters that indicates the format of valid input values. When you define an input mask for a field, you specify the characters that can enter the field and the order in which they must appear.
Input masks are useful for data entry control because they:
- Make data entry easier and more consistent by providing a clear guide for what characters can be entered at each position in a field.
- Validate data as it is entered. Users cannot enter characters that are not part of the input mask.
Input masks are defined by a string of characters, some of which are placeholders for real characters that will be entered by the user and some of which are characters that define the format of the input. For example, the input mask string LL/CC/0000
defines an input mask for a field that will accept two letters followed by a slash, two letters, another slash, and four numbers. The characters L
and C
are placeholders for letters that the user will enter, and the character 0
is a placeholder for a number.
Creating an Input Mask in Microsoft Access
To create an input mask:
- Open the table in Design view.
- Click the field for which you want to create an input mask.
- In the Field Properties area, click the Input Mask property box.
- In the Input Mask Wizard, do one of the following:
- If you want to create an input mask for a field that already has data in it, click Edit Mask.
- If you want to create an input mask for a field that does not have data in it, click Create Mask.
The Input Mask Wizard starts.
Edit Mask
If you click Edit Mask, the wizard displays the existing input mask for the field and the current data in the field.
Create Mask
If you click Create Mask, the wizard prompts you to enter the characters that can be entered at each position in the field.
Defining an Input Mask
When you define an input mask, you specify the characters that can be entered at each position in the field and the order in which they must appear. You do this by entering the characters that can be entered in the field and then entering placeholders for the characters that you want the user to enter.
The following table shows the characters that you can use to define an input mask and the meaning of each character.
Character | Description |
---|---|
0 |
A digit (0 through 9) or a plus (+) or minus (-) sign. |
9 |
A digit or space. |
# |
A digit, plus (+) or minus (-) sign, or space. |
L |
An uppercase letter (A through Z). |
l |
A lowercase letter (a through z). |
A |
An uppercase or lowercase letter (A through Z, a through z). |
& |
An uppercase or lowercase letter, a space, or an underscore (_). |
C |
An uppercase or lowercase letter (A through Z, a through z), a digit (0 through 9), or an underscore (_). |
& |
An uppercase or lowercase letter (A through Z, a through z). |
a |
An uppercase or lowercase letter (A through Z, a through z) or a digit (0 through 9). |
* |
Any character or space. |
Examples of Input Masks
The following table shows some examples of input masks.
Input Mask | Description |
---|---|
&&&&&&&&&&&&& |
An ampersand (&) for each character in the field. The field can contain up to 30 characters. |
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& |
An ampersand (&) for each character in the field. The field can contain up to 50 characters. |
LL/CC/0000 |
Two letters, a slash (/), two letters, another slash (/), and four numbers. For example, AB/CD/1234 .
|
>L<LLL&&&&&&&&&& |
The greater than (>) and less than (<) characters define literal characters that will be displayed in the field. The field can contain up to 20 characters. |
000-000-0000 |
Three numbers, a hyphen (-), three numbers, another hyphen (-), and four numbers. For example, 123-456-7890 .
|
>LL<&&&&&&&&&&&&&&&&&&&&& |
When you have a field that requires a specific format, such as a telephone number or a part number, you can use an input mask to automatically enter the correct characters. To create an input mask: 1. Open the table in Design View. 2. Select the field to which you want to add an input mask. 3. Click the Input Mask property box, and then click the Build button . 4. In the Input Mask Wizard, click the Input Mask list, and then select the input mask that you want to use. 5. If you want to display placeholders for the characters that the user must enter, select the Show Placeholder Characters check box. 6. If you want the input mask to be stored in the table, select the Store Mask In Table check box. 7. Click Finish. |