DekGenius.com
[ Team LiB ] Previous Section Next Section

Recipe 16.2 Display Multiple Smart Tags on Multiple Forms

16.2.1 Problem

I have a table in my database that is used for many forms. I'd like to use the Person Name smart tag as well as the Date smart tag on the LastName field. I have already created the forms. How can I create multiple smart tags on LastName without having to create them separately on each form?

16.2.2 Solution

It's understandable that you might want to use the Date smart tag in conjunction with the Person smart tag. Fortunately, Access easily supports assigning multiple smart tags to a control on a form or a field in a table.

You can take two actions with the built-in Date smart tag:

  • Schedule a meeting.

  • Display your calendar.

If you create a smart tag on a field in a table, then any forms you create subsequently will inherit the smart tag. The documentation states that previously existing forms will not inherit a smart tag created on a table field if the smart tag is created after the forms. However, the help file was apparently written before additional functionality was added that does allow for forms to inherit smart tags, as you'll see in this recipe.

Follow these steps to add the Person and Date smart tags to the LastName field in the Employees table:

  1. Open the Employees table in the sample application in design view.

  2. Select the LastName Field and click the builder button to the right of the Smart Tags property at the bottom of the General tab.

  3. Select the Person Name and Date checkboxes in the Smart Tags dialog box and click OK. This will create the following entry in the Smart Tags property, where the smart tags are listed in a semicolon-delimited string:

    "urn:schemas-microsoft-com:office:smarttags#date";
    "urn:schemas-microsoft-com:office:smarttags#PersonName"
  4. Click to the left of the Smart Tags property, and you will see another smart tag, which when expanded includes the option Update Smart Tags everywhere LastName is used. Select this option, and select any existing forms you wish to inherit the new smart tags. In this example, frmEmployees can inherit the smart tags.

  5. Save the table and view it in datasheet view. Figure 16-4 shows the Date smart tag menu displayed for the Last Name field.

Figure 16-4. Multiple smart tags are displayed with flyout menus
figs/acb2_1604.gif
  1. Open frmEmployees. You should see both smart tags displayed when you click in the LastName control.

  2. Click the New Object: AutoForm button on the toolbar to create a new form based on the table. Note that the Last Name TextBox has inherited the smart tag. Open the existing form and note that the smart tag property is also displayed.

16.2.3 Discussion

When you create a smart tag on a table, Access gives you the ability to propagate the smart tag to any new forms that you may create. You can also propagate the smart tag to any forms that you may have created prior to creating the smart tag.

If you delete the smart tag from the table and do not select the "Update Smart Tags everywhere" option, then form smart tags that were inherited from table smart tags will not be deleted. Make sure that you select the "Update Smart Tags everywhere" option if you want inherited smart tags to be removed from the forms as well as the table.

    [ Team LiB ] Previous Section Next Section