Access Commands – Accessible from the ‘Help’ Menu

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

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 in Microsoft
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 (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 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 9811598115-3007 >L<?????????????? Maria Pierre ISBN 0-&&&&&&&&&-0 ISBN 1-55615-507-7 ISBN 0-13-964262-5 >LL00000-0000 DB51392-0493 Examples of field validation rules ValidationRule setting ValidationText setting <>0 Please enter a nonzero value.Input mask examples The following table shows some useful input mask (input mask: A format that consists of literal display characters (such as parentheses.) definitions and examples of values you can enter into them. . periods. 0 or >100 Value must be either 0 or over 100. <#1/1/2000# Enter a date before 2000. 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.

The following example works in an Access database that uses Microsoft SQL Servercompatible syntax (ANSI-92). You can use a zero-length string to indicate that you know there's no value for a field.Y. N.) Date( ) Today's date =Yes Yes displayed in the local language of the computer. . You can use also wildcard characters in a field validation rule.>=#1/1/2000# and <#1/1/2001# Date must be in 2000.0) = 0 Data in the LastName field must be uppercase. (note that you must enclose the value in quotes if it includes punctuation) "" Zero-length string (zero-length string: A string that contains no characters. ValidationRule setting Alike "K___" ValidationText setting Value must be four characters beginning with the letter K. N. The following example works in an Access database that uses Microsoft Jet SQL syntax. Examples of default values in fields Expression Default field value 1 1 "MT" MT "New York. ValidationRule setting Like "K???" ValidationText setting Value must be four characters beginning with the letter K.Y. Which wildcard characters you use depends on the ANSI SQL query mode of the Microsoft Access database. StrComp(UCase([LastName]). [LastName]." New York. You enter a zerolength string by typing two double quotation marks with no space between them (" ").

" . For example. or drop-down list box. and how you expect people to use it. or combo box (use when the list won't change very often). Ltd. the list box is bound. or Ms. base the list box on a record source. or they can come from a record source (use when you'll frequently update the list). For example. drop-down list box. or combo box. or Access can pass the value to another control. Pick a supplier from the list. combo box. for the Supplier list box in the preceding illustration. Ltd. 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). in the Suppliers table and sets the SupplierID field (the foreign key) for the current record in the Products table to the same value. how you want the control to appear on your form or data access page. combo box.. For example. drop-down list box. drop-down list box. 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. you would create an unbound list box. Each control offers advantages: . or combo box to determine the contents of another control or controls. you need to decide two things: • • Where will the rows for the list come from? When a user selects an item in the list box. if a user selects "Pavlova. 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. (Note that the SupplierName value that comes from the Suppliers table is displayed in the list box but not stored. or combo box. a combo box. This is the value that is stored. When a user selects a value in a list box. Because Access is storing a value based on a selection in the list box. drop-down list box. on the other hand.About creating a list box. 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. you want Access to use the value selected in the list box. Mrs. but the list will change frequently. on the other hand. you have a Products form and you want to display a list of product suppliers in a list box..) If. drop-down list box. drop-down list box. Access looks up the primary key value (SupplierID) for Pavlova. think about where you're going to use the control. drop-down list box. what will Microsoft Access do with that value? The rows for a list box. Should I create a list box. or combo box. Enter a product. If. or a drop-down list box? To decide whether to create a list box. you could use a fixed list for a list box that contains entries for Mr. or drop-down list box that looks up values To create a list box. or combo box that looks up values. or combo box can come from a fixed list of values that you enter when you create the list box.

combo box. and then include this field in the list box. Use a query in the following cases: • • If you want to include calculated fields in the list box. you can't add a value that's not in the list. combo box. Since the list isn't displayed until you open it. the control uses less room on the data access page. or drop-down list box yourself. You could define this calculated field in a query. or drop-down list box. drop-down list box. Advantages of a drop-down list box You can use drop-down list boxes on data access pages. 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. 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. If you want to include fields from more than one table in the list box. In most cases. Advantages of a combo box You can use combo boxes on forms. When you're using a form to enter or edit data. Access sets the ListRowSource property of the list box or drop-down list box to the table or query you selected. you can set the row source to a table or a saved query. the control uses less room on the form. . For example. you can type that letter. or if the values aren't stored in a database. To move quickly to the first value that starts with a particular letter. You can also set the row source of a list box. or combo box. However. When you select fields from a table or query by using a wizard in a form. The value of the control is limited to the set of alternatives in the list. or only text that matches one of the values in the list can be entered. For example. or combo box with a wizard. or combo box. The list appears at all times and the value of the control is limited to the set of alternatives in the list. You can also control whether any value can be entered in the list. combo box. In addition. or drop-down list box provides the values that are displayed. you could concatenate a first name and a last name by typing the following expression: Name: [FirstName] & " "& [LastName]. Because the list isn't displayed until you open it.Advantages of a list box You can use list boxes on forms and data access pages. or a function to provide the values? The row source of a list box. You can type the first few characters of a value in the combo box to quickly find that value. or you can set the row source to an SQL statement so that the query doesn't show up in the Database window. a query. list boxes and combo boxes based on SQL statements are slower than list boxes and combo boxes based on saved queries. For example. When you select fields from a table or query by using a wizard in a data access page. drop-down list box. drop-down list box. you can use a table as the row source when you create the list box. an SQL statement. To move quickly to the first value that starts with a particular letter. Should I use a table. you can use a function as a type of row source when the values in a list are constantly changing. you can type that letter.

Ways to create a list box. If you don't plan to use the same lookup list in more than one form. you will have to create a list box or drop-down list box on your own. You can't use a Lookup field to create a list box or drop-down list box in a data access page. or when you point a data access page to another database than the one currently open. combo box. or drop-down list box. For example. In this case. When you create a Lookup field. you might not want to use a wizard or lookup field if you want to specify that the type of row source is a function. On your own You might want to create a list box. you can use the List Box Wizard or Combo Box Wizard in form Design view. or drop-down list box that is bound to a Lookup field in a Microsoft Access database or in a Microsoft Access project that is connected to a database in Microsoft SQL Server 2000 or the Microsoft Access SQL Server Desktop Engine. combo box. you only need to create the list box or combo box once. or drop-down list box Wizards Using a wizard is an easy way to create a list box. or drop-down list box without using a wizard or lookup field if you want to set the properties of the control yourself. However. . combo box. Then you can use the same lookup list on any form. wizards are not available in a stand-alone data access page. Lookup fields You can create a list box. combo box.