Article ID: 311171 - Last Review: January 31, 2007 - Revision: 5.6 Part 4 of "Keeping Your Information Accurate in Access 2003 and Access 2002": Using an input mask to restrict dataThis article was previously published under Q311171 On This PageSUMMARY The information covered in this article is provided by the
Microsoft Press. For more information, visit the following Microsoft Web site: http://mspress.microsoft.com/
(http://mspress.microsoft.com/)
This article is part 4 of a series of eight
articles that explain how to keep your information in Access accurate. To view
the other articles in this series, see the "Additional resources"
section later in this article. This information is an excerpt from chapter 6: "Keeping Your Information Accurate" of the book Microsoft Access Version 2002 Step by Step. For more information about this book, see the "References" section. MORE INFORMATION When you use masks in tables or forms, people entering information can see at a
glance the format in which they should make entries and how long they should
be. You can use the InputMask property to control how data is entered in text, number,
date/time, and currency fields. This property has three sections, separated by
semicolons, like the mask for a telephone number shown here:
!\(000") "000\-0000;1;#
The first section contains characters that are used as
placeholders for the information to be typed, as well as characters such as
parentheses and hyphens. Together, all these characters control the appearance
of the entry. The following list explains the purpose of the most common input
mask characters:
Character Description
------------------------------------------------------------------------
0 Required digit (0 through 9).
9 Optional digit or space.
# Optional digit or space; blank positions are converted
to spaces; plus and minus signs are allowed.
L Required letter (A through Z).
? Optional letter (A through Z).
A Required letter or digit.
a Optional letter or digit.
& Required character (any kind) or a space.
C Optional character (any kind) or a space.
< All characters that follow are converted to lowercase.
> All characters that follow are converted to uppercase.
! Characters typed into the mask fill it from left to right.
You can include the exclamation point anywhere in the
input mask.
\ Character that follows is displayed as a literal
character.
Password Creates a password entry box. Any character typed in the
box is stored as the character but is displayed as an
asterisk (*).The second and third sections of the input mask are optional. Including a 1 or leaving nothing in the second section tells Access to store only the characters entered; including a 0 tells it to store both the characters entered and the mask characters. The character in the third section is displayed in a new record as the placeholder for the characters to be typed. This placeholder defaults to an underscore if the section is omitted. The input mask !\(000") "000\0000;1;# creates this display in a field in both a table and a form:
(###) ###-####
In this case, you are restricting the entry to ten digits--no
more and no less. Access stores just the digits entered, not the parentheses,
space, and dash (though those characters could be displayed in your table,
form, or report if you set the correct format property).In this exercise, you will use the Input Mask Wizard to apply a predefined telephone input mask to a text field, forcing entered numbers into the (206) 555-0001 format. You will then create a custom mask to force the first letter of an entry to be uppercase (a capital letter). Follow these steps:
ADDITIONAL RESOURCESFor additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:311167
(http://support.microsoft.com/kb/311167/
)
Part 1 of "Keeping Your Information Accurate": Introduction for Access 2003 and Access 2002
311168
(http://support.microsoft.com/kb/311168/
)
Part 2 of "Keeping Your Information Accurate": Using the data type to restrict data in Access 2003 and Access 2002
311169
(http://support.microsoft.com/kb/311169/
)
Part 3 of "Keeping Your Information Accurate": Using the field size property to restrict data in Access 2003 and Access 2002
311171
(http://support.microsoft.com/kb/311171/
)
Part 4 of "Keeping Your Information Accurate": Using an input mask to restrict data in Access 2003 and Access 2002
311172
(http://support.microsoft.com/kb/311172/
)
Part 5 of "Keeping Your Information Accurate": Using validation rules to restrict data in Access 2003 and Access 2002
311173
(http://support.microsoft.com/kb/311173/
)
Part 6 of "Keeping Your Information Accurate": Using a lookup list to restrict data in Access 2003 and Access 2002
311174
(http://support.microsoft.com/kb/311174/
)
Part 7 of "Keeping Your Information Accurate": Updating information in a table in Access 2003 and Access 2002
311175
(http://support.microsoft.com/kb/311175/
)
Part 8 of "Keeping Your Information Accurate": Deleting information from a table in Access 2003 and Access 2002
REFERENCES The information in this article is an excerpt from the Microsoft Access Version 2002 Step by Step book, published by Microsoft Press.
To learn more about
the Microsoft Access Version 2002 Step by Step book, and to see a sample chapter from this book, visit the following Microsoft Web site: http://www.microsoft.com/mspress/books/sampchap/5054.aspx
(http://www.microsoft.com/mspress/books/sampchap/5054.aspx)
For more information
about this publication and about other Microsoft Press titles, visit the following Microsoft Web site:
http://mspress.microsoft.com
(http://mspress.microsoft.com)
| Article Translations
|
Back to the top




