Professional Documents
Culture Documents
Input Mask
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
Digit (0 through 9, entry required; plus [+] and minus [-] signs not allowed).
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).
&
.,:;-/
Decimal placeholder and thousands, date, and time separators. (The actual
character used depends on the regional settings specified in Microsoft
Windows Control Panel.)
<
>
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.
Password
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
9811598115-3007
>L<??????????????
Maria
Pierre
ISBN 0-&&&&&&&&&-0
ISBN 1-55615-507-7
ISBN 0-13-964262-5
>LL00000-0000
DB51392-0493
ValidationText setting
<>0
0 or >100
<#1/1/2000#
>=#1/1/2000#
and <#1/1/2001#
StrComp(UCase([LastName]),
[LastName],0) = 0
You can use also wildcard characters in a field validation rule. Which wildcard characters
you use depends on the ANSI SQL query mode of the Microsoft Access database.
The following example works in an Access database that uses Microsoft Jet SQL syntax.
ValidationRule setting
Like "K???"
ValidationText setting
Value must be four characters beginning with the letter K.
The following example works in an Access database that uses Microsoft SQL Servercompatible syntax (ANSI-92).
ValidationRule setting
Alike "K___"
ValidationText setting
Value must be four characters beginning with the letter K.
"MT"
MT
""
Date( )
Today's date
=Yes
The rows for a list box, drop-down list box, or combo box can come from a fixed list of
values that you enter when you create the list box, drop-down list box, or combo box (use
when the list won't change very often), or they can come from a record source (use when
you'll frequently update the list). For example, you could use a fixed list for a list box that
contains entries for Mr., Mrs., or Ms. If, on the other hand, you have a Products form and
you want to display a list of product suppliers in a list box, but the list will change
frequently, base the list box on a record source. The list box looks up values in the
Suppliers table and displays an up-to-date list of the suppliers that you can choose from.
Enter a product.
Pick a supplier from the list.
When a user selects a value in a list box, drop-down list box, or combo box, Microsoft
Access can do one of two things: Access can store the selected value in a table (not the
same table that the list gets its rows from), or Access can pass the value to another
control. For example, for the Supplier list box in the preceding illustration, if a user
selects "Pavlova, Ltd." , Access looks up the primary key value (SupplierID) for Pavlova,
Ltd. in the Suppliers table and sets the SupplierID field (the foreign key) for the current
record in the Products table to the same value. This is the value that is stored. Because
Access is storing a value based on a selection in the list box, the list box is bound. (Note
that the SupplierName value that comes from the Suppliers table is displayed in the list
box but not stored.)
If, on the other hand, you want Access to use the value selected in the list box, drop-down
list box, or combo box to determine the contents of another control or controls, you
would create an unbound list box, drop-down list box, or combo box. For example, you
might want to create a list box or drop-down list box that you can use to find a related
record on a data access page. Or you might want to create a list box or combo box that
you use to filter the records in another list box or combo box on a form.
Should I create a list box, a combo box, or a drop-down list box?
To decide whether to create a list box, combo box, or drop-down list box, think about
where you're going to use the control, how you want the control to appear on your form
or data access page, and how you expect people to use it. Each control offers advantages:
Advantages of a list box You can use list boxes on forms and data access pages. The
list appears at all times and the value of the control is limited to the set of alternatives in
the list. To move quickly to the first value that starts with a particular letter, you can type
that letter. When you're using a form to enter or edit data, you can't add a value that's not
in the list.
Advantages of a combo box You can use combo boxes on forms. Since the list isn't
displayed until you open it, the control uses less room on the form. You can type the first
few characters of a value in the combo box to quickly find that value. You can also
control whether any value can be entered in the list, or only text that matches one of the
values in the list can be entered.
Advantages of a drop-down list box You can use drop-down list boxes on data access
pages. Because the list isn't displayed until you open it, the control uses less room on the
data access page. The value of the control is limited to the set of alternatives in the list.
To move quickly to the first value that starts with a particular letter, you can type that
letter.
Should I use a table, a query, an SQL statement, or a function to provide the values?
The row source of a list box, combo box, or drop-down list box provides the values that
are displayed. In most cases, you can use a table as the row source when you create the
list box, drop-down list box, or combo box with a wizard. Use a query in the following
cases:
If you want to include calculated fields in the list box, drop-down list box, or
combo box. For example, you could concatenate a first name and a last name by
typing the following expression: Name: [FirstName] & " "& [LastName]. You
could define this calculated field in a query, and then include this field in the list
box, drop-down list box, or combo box.
If you want to include fields from more than one table in the list box, combo box,
or drop-down list box.
When you select fields from a table or query by using a wizard in a form, Microsoft
Access creates an SQL statement based on the fields that you select and sets the
RowSource property of the list box or combo box to that SQL statement. When you
select fields from a table or query by using a wizard in a data access page, Access sets the
ListRowSource property of the list box or drop-down list box to the table or query you
selected.
You can also set the row source of a list box, combo box, or drop-down list box
yourself. For example, you can set the row source to a table or a saved query, or you can
set the row source to an SQL statement so that the query doesn't show up in the Database
window. However, list boxes and combo boxes based on SQL statements are slower than
list boxes and combo boxes based on saved queries.
In addition, you can use a function as a type of row source when the values in a list are
constantly changing, or if the values aren't stored in a database. For example, you could
write a function that fills a list box with a list of dates, each one a specific number of days
after the current date.