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:

NOTE

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.


1.

Close any open objects.

2.

Open the tblShippers table in Design view.

3.

Click in the ShipPhone field.

4.

Click in the Input Mask property.

5.

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

6.

In the Input Mask Wizard, click Edit List.

7.

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.


8.

In Description, enter Phone Number with Letters

9.

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.

10.

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

11.

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.


12.

Select Phone Number with Letters in the Input Mask Wizard.

13.

Click Next twice and click Finish.

14.

Choose File, Save

15.

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

16.

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

17.

Close the Shippers table.

NOTE

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

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net