Examples of input masks

An input mask is used in fields (in tables and queries) and in text boxes and combo boxes (in forms) to format data and provide some control over what values can be entered. An input mask consists of literal characters (such as spaces, dots, dashes, and parentheses) that separate blanks to fill in. The InputMask property setting consists of literal characters along with special characters that determine the kind of value that can be entered into the blank in that position. Input masks are primarily used in Text and Date/Time fields, but can also be used in Number or Currency fields.

This topic provides reference information about:

Examples of input masks

Defining input masks

Valid input mask characters

Examples of input masks

The following table shows some useful input mask definitions and examples of values you can enter into them. Refer to the table at the end of this topic for details on the codes used to create input mask definitions.

Input mask definition Examples of values
(000) 000-0000 (206) 555-0248
(999) 999-9999! (206) 555-0248
  (   ) 555-0248
(000) AAA-AAAA (206) 555-TELE
#999 -20
  2000
>L????L?000L0 GREENGR339M3
  MAY R 452B7
>L0L 0L0 T2F 8M4
00000-9999 98115-
  98115-3007
>L<?????????????? Maria
  Pierre
ISBN 0-&&&&&&&&&-0 ISBN 1-55615-507-7
  ISBN 0-13-964262-5
>LL00000-0000 DB51392-0493

Return to top

Defining input masks

The input mask definition can contain up to three sections separated by semicolons; for example, (999) 000-0000!;0;" ".

Section Meaning
First The input mask itself.
Second Determines whether to store the literal display characters.

0 = store literal characters with the value entered

1 or leave blank = store only characters entered in blanks

Third Character that is displayed for blanks in the input mask. You can use any character; type " " (double quotation marks, space, double quotation marks) to display a space. If you leave this section blank, the underscore ( _ ) is used.

Return to top

Valid input mask characters

Microsoft Access interprets characters in the first part of the InputMask property definition as shown in the following table. To define a literal character, enter any character other than those shown in the table, including spaces and symbols. To define one of the following characters as a literal character, precede that character with a \.

Character Description
0 Digit (0 through 9, entry required; plus [+] and minus [-] signs not allowed).
9 Digit or space (entry not required; plus and minus signs not allowed).
# Digit or space (entry not required; blank positions converted to spaces, plus and minus signs allowed).
L Letter (A through Z, entry required).
? Letter (A through Z, entry optional).
A Letter or digit (entry required).
a Letter or digit (entry optional).
& Any character or a space (entry required).
C Any character or a space (entry optional).
. , : ; - / Decimal placeholder and thousands, date, and time separators. (The actual character used depends on the regional settings specified by double-clicking Regional Settings in the Windows Control Panel.)
< Causes all characters that follow to be converted to lowercase.
> Causes all characters that follow to be converted to uppercase.
! Causes the input mask to display from right to left, rather than from left to right. Characters typed into the mask always fill it from left to right. You can include the exclamation point anywhere in the input mask.
\ Causes the character that follows to be displayed as a literal character. Used to display any of the characters listed in this table as literal characters (for example, \A is displayed as just A).
Password Setting the InputMask property to the word Password creates a password entry text box. Any character typed in the text box is stored as the character but is displayed as an asterisk (*).

Return to top

More information

Create an input mask