Tuesday, October 30, 2007

MS ACCESS - Input mask syntax and examples

Many people struggle with input mask special characters so here is the help file from MS Access:

Valid input mask characters

Microsoft Access interprets characters in 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 backslash (\).

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
< Causes all characters that follow to be converted to lowercase.
> Causes all characters that follow to be converted to uppercase.
! Causes the input mask (input mask: A format that consists of literal display characters (such as parentheses, periods, and hyphens) and mask characters that specify where data is to be entered as well as what kind of data and how many characters are allowed.) 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 (*).
Input mask examples
The following table shows some useful input mask (input mask: A format that consists of literal display characters (such as parentheses, periods, and hyphens) and mask characters that specify where data is to be entered as well as what kind of data and how many characters are allowed.) definitions and examples of values you can enter into them.
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

>LMaria
Pierre

ISBN 0-&&&&&&&&&-0
ISBN 1-55615-507-7
ISBN 0-13-964262-5

>LL00000-0000
DB51392-0493

No comments:

Search This Blog

Desktop Applications Training Blog


Jamie Johnson
JJSurf IT Training Ltd
http://www.jjsurf.co.uk/