Case Example

It would certainly be nice if Access offered a wider selection of predefined masks in the Input Mask Wizard. However, you can create customized masks.

Currently, the telephone number in the Shippers table can accommodate only numbers, as in (212) 555-7685. You want an input mask in which the last four characters can be either numbers or letters, as in (212) 555-FAST. Here's how to add the mask:


The following example adds a custom input mask that will be available whenever you use Access. You can edit the mask, but I don't know of a way to eliminate all traces of it if you need to delete it. If for some reason you need to keep your copy of Access pristine, don't add this mask.


Close any open objects.


Open the tblShippers table in Design view.


Click in the ShipPhone field.


Click in the Input Mask property.


Click the triple-dot button in the Input Mask property.


In the Input Mask Wizard, click Edit List.


Click the New Record button at the bottom (see Figure 6.13).

Figure 6.13. The Customize Input Mask Wizard dialog box in the Input Mask Wizard.


In Description, enter Phone Number with Letters


In Input Mask, enter (000) 000-AAAA. The symbol 0 is a required number; the symbol A is a required alphanumeric character. Thus, the last four digits can be either numbers or letters.


In Sample Data, enter (201) 555-FAST. Leave Placeholder and Mask Type as they are.


Click Close. Note that the Phone Number with Letters input mask is now among your list (see Figure 6.14). This mask will be available to you in the future in Access.

Figure 6.14. The new Phone Number with Letters mask is now among your selections.


Select Phone Number with Letters in the Input Mask Wizard.


Click Next twice and click Finish.


Choose File, Save


Click View to switch to Datasheet view. Now let's test the new input mask.


Click in the Phone field for EAN lines. Edit the number to (305) 555-QUIK and press Tab.


Close the Shippers table.


This example just scratches the surface when it comes to the possibilities of the masks you can create. As I recommended with the Format property, I suggest that you click in the Input Mask property in any table and press F1 to see the available symbols and examples of various masks you can use in Access.

Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider © 2008-2017.
If you may any questions please contact us: