An input mask is used 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 Input Mask 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.
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(206) 555-0248( ) 555-0248 |
(000) AAA-AAAA |
(206) 555-TELE |
#999 |
-202000 |
>L????L?000L0 |
GREENGR339M3MAY R 452B7 |
>L0L 0L0 |
T2F 8M4 |
00000-9999 |
98115-98115-3007 |
>L<?????????????? |
MariaPierre |
ISBN 0-&&&&&&&&&-0 |
ISBN 1-55615-507-7ISBN 0-13-964262-5 |
>LL00000-0000 |
DB51392-0493 |
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 entered1 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. |
VisionCore interprets characters in the first part of the Input Mask 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 |
A single digit must be entered in this position. |
9 |
A digit or a space can be entered in this position. If the user skips this position by moving the cursor past the position without entering anything, Access stores nothing in this position. |
# |
A digit, a space, or a plus or minus sign can be entered in this position. If the user skips this position by moving the cursor past the position without entering anything, Access stores a space. |
L |
A letter must be entered in this position. |
? |
A letter can be entered in this position. If the user skips this position by moving the cursor past the position without entering anything, Access stores nothing. |
A |
A letter or a digit must be entered in this position. |
a |
A letter or a digit can be entered in this position. If the user skips this position by moving the cursor past the position without entering anything, Access stores nothing. |
& |
A character or a space must be entered in this position. |
C |
Any character or a space can be entered in this position. If the user skips this position by moving the cursor past the position without entering anything, Access stores nothing. |
. |
Decimal placeholder (depends on the setting in the Regional Settings section of Windows Control Panel). |
, |
Thousands separator (depends on the setting in the Regional Settings section of Windows Control Panel). |
: ; - / |
Date and time separators (depends on the settings in the Regional Settings section of Windows Control Panel). |
< |
Converts to lowercase all characters that follow. |
> |
Converts to uppercase all characters that follow. |
! |
Causes the mask to fill from right to left when you define optional characters on the left end of the mask. You can place this character anywhere in the mask. |
\ |
Causes the character immediately following to be displayed as a literal character rather than as a mask character. |
"literal" |
You can also enclose any literal string in double quotation marks rather than use the \ character repeatedly. |