Should I use a data display format or an input mask?

Microsoft Access provides two field properties that produce similar results: the Format property and the InputMask property.

Use the Format property to display data in a consistent format. For example, if you set the Format property for a Date/Time field to Medium Date format, all dates entered will display in this form: 12-Jan-96. If a user of your database enters a date in the form, 01/12/96 (or any other valid date format), Microsoft Access will convert the display to the Medium Date format when the record is saved.

The Format property affects only how a value is displayed, not how it is stored in the table. Also, a display format isn't applied until the data entered is saved — nothing is displayed in the field to suggest or control the format in which data is entered. If you need to control how data is entered, use an input mask in addition to, or instead of, a data display format. If you want data to display exactly as entered, don't set the Format property.

Predefined display formats are available for Number, Currency, Date/Time, AutoNumber, and Yes/No fields, and you can define custom formats for them as well. There are no predefined formats for Text, Memo, or Hyperlink fields, but you can define custom formats. You can't define a display format for OLE Object fields.

Use the InputMask property to display literal display characters in the field with blanks to fill in. For example, if all phone numbers you enter in a field have the same format, you can create an input mask as shown in the following illustration.

Input masks provide blanks to fill in

An input mask ensures that the data will fit in the format you define, and you can specify the kind of values that can be entered in each blank. For example, the preceding input mask requires that all entries contain exactly enough digits to make up a U.S. area code and telephone number, and that only digits be entered in each blank.

If you define both a display format and an input mask for a field, Microsoft Access uses the input mask when you are adding or editing data, and the Format setting determines how the data is displayed when the record is saved. When using both Format and InputMask properties, be careful that their results don't conflict with each other.

More information

Use the Format property to set display formats

Use the InputMask property to control how data is entered