You can help people enter data correctly into your Access desktop database by providing input masks for fields that contain data that is always formatted a certain way. For example, you can use an input mask to make sure that people enter correctly formatted phone numbers into a phone number field. Show
An input mask only affects whether Access accepts the data – the mask does not change how the data is stored, which is controlled by the field’s data type and other properties. For more information about how data is stored in Access, see the article Introduction to data types and field properties. Important: This article only applies to Access desktop databases. Access web apps and web databases do not support input masks. In this article
About input masksAn input mask is a string of characters that indicates the format of valid input values. You can use input masks in table fields, query fields, and controls on forms and reports. The input mask is stored as an object property. You use an input mask when it’s important that the format of the input values is consistent. For example, you might use an input mask with a field that stores phone numbers so that Access requires ten digits of input. If someone enters a phone number without the area code, Access won’t write the data until the area code data is added. The three parts of an input maskInput masks are made up one mandatory part and two optional parts, and each part is separated by a semicolon. The purpose of each part is as follows:
For example, this is an input mask for a telephone numbers in the U.S. format: (999) 000-000;0;-:
Characters that define input masksThe following table lists the placeholder and literal characters for an input mask and explains how it controls data entry:
When to avoid using input masks in AccessAs useful as they are, input masks are not appropriate in every situation. Don’t use an input mask if following circumstances apply to you:
Add an input mask to a table field using the Input Mask WizardYou can use input masks with fields that are set to the Text, Number (except ReplicationID), Currency, and Date/Time data types. Note: If you use an input mask for a Date/Time field, the Date Picker control becomes unavailable for that field.
Add an input mask to a query
Add an input mask to a form or report control
Create custom input masksWhile the Input Mask Wizard provides input masks for most common formatting needs, you may sometimes want to customize input masks to better suit your needs. Input masks can be customized by either changing the predefined masks from the Input Mask Wizard or by manually changing the Input Mask property for a field where you want the mask applied. Customize input masks from the Input Mask Wizard
Customize input masks from the field property setting
You must manually type the input mask definition for Number and Currency fields. Examples of input masksThe examples in the following table demonstrate some ways that you can use input masks.
Using input masks for email addressesBecause email addresses vary widely in the number of characters they contain, input masks are not a good tool for ensuring that email addresses are entered correctly. Instead, we recommend using the Validation Rule and Validation Text properties. The validation rule shown in the following table ensures that the email address is entered with one or more characters, then an “@” sign, then one or more characters, then a period, and then one or more characters. For example, would be allowed, but tom@example,com or tom@example would not. If you enter an email address that doesn’t match the validation rule, Access doesn’t accept the input and displays the message in the Validation Text property. If no text is entered in the Validation Text property box, Access displays a generic message.
For more information about using validation rules, as well as step-by-step procedures, see the article Restrict data input by using a validation rule. Top of Page Which of the following input mask characters requires a user to enter a letter or number?Characters that define input masks. Which of the following wildcard characters does Access use in validation rules to match any number of characters?Matches any number of characters. You can use the asterisk (*) anywhere in a character string.
Which of the following characters separate the parts of an input mask?An input mask consists of three sections that are separated with a semicolon.
Which of the following options forces a user to enter data using a specific format?An input mask forces a user to enter data using a specific format.
|