Developing Smart Tag Solutions with Microsoft Office Access 2003


Frank C. Rice
Microsoft Corporation

March 2003

Applies to:
   Microsoft Office Access 2003

Summary: Learn about an exciting new feature in Microsoft Office Access 2003: smart tags. With smart tags, you can extend your Access solutions by easily adding additional functionality for your users. There is also programmatic support for smart tags that allows you to automate setting or modifying smart tag settings. (11 printed pages)


How Smart Tags Work in Access
Using Smart Tags
Enabling or Disabling the Display of Smart Tags
Setting or Modifying the SmartTags Property Programmatically
Other Pertinent Information
Additional Resources


Microsoft Office Access 2003 introduces smart tag technology to database developers. This allows you to expose some of the smart tag functionality seen in other Microsoft Office programs to your users. You can embed smart tags in database fields using a new SmartTags property. As users scroll through form or data access page records, for example, they can click a field's smart tag icon and select an action appropriate to that field. Reports do not support smart tags.


Smart tags provide the unique ability to link text in Office applications (Microsoft Word, Microsoft Excel, Microsoft Outlook, Microsoft PowerPoint, and now, Access) to other business applications and processes. This enables users to have much easier access to data and external functionality than before. Rather than moving among multiple applications, smart tags can add context by passing data from Office programs such as Access or Excel, to other applications, including other Office applications, based on the content of a field. This contextual linking provides a great potential for productivity improvement. For example, a smart tag may be enabled in a customer name or address field that enables the user to take action in another application such as Outlook or a customer database. More information about smart tags is available in the Additional Resources section at the end of this article.

There are some differences between the way that smart tags work in Access 2003 and the way they work in other Office applications such as Word or Excel. In the following sections, we will explore and demonstrate in detail this new addition for Access.

How Smart Tags Work in Access

Table fields, as well as form and data access page controls, now have a new property setting for specifying smart tags named, appropriately enough, SmartTags. In addition, query columns inherit this property from the source tables on which they are based. For example, consider the following scenario:

Joe has heard about the new features in Access 2003 and wants to add smart tags to a data access page his company uses for publishing information to the Web. He opens the page in Design view, opens the Property page for the control to which he wants to apply the smart tag, and then clicks the SmartTags property. The Smart Tags dialog box appears, which displays a list of smart tags installed on his system. Joe selects the smart tags that he wants applied to this field and then saves and republishes the data access page. Now, when users browse the page and move their cursor to the field, the smart tag icon appears and they can select the smart tag actions appropriate for the particular field.

Providing smart tags in Access solutions has a number of benefits:

  • The technology can be targeted so that just the smart tags you want your users to use are included with the solution.
  • Enhanced functionality is available without you having to add code to your solution to implement it.
  • The available smart tag actions can be modified or new ones can be added without modifying the Access solution.
  • Smart tag technology has been available in Word, Excel, and Outlook since Office XP so little or no learning curve is involved in using it in Access.

One of the key differences in the Access smart tag implementation and the smart tags found in Word or Excel is that there are no recognizers available in Access. In Word or Excel, the code associated with the smart tag can monitor text entered by the user. When a particular term is "recognized," a smart tag is displayed with actions appropriate to that term. For example, if a user types a person's name in a Word document, a smart tag might recognize that term as a name and display a set of actions, including one which allows the user to look up the e-mail address of the person. In Access, smart tags do not respond based on the type or context of a particular term but rather, once set, the smart tag is either available for a field or not, regardless of the text in the field.

In addition, setting the SmartTags property on a table or query field does not propagate the smart tag to any dependent forms or data access pages. You would need to explicitly set the property on the control in the dependent object, or recreate the form or page based on the updated table or query. However, smart tags are inherited by any new forms or data access forms created from a table or query containing smart tags.

Using Smart Tags

Here is a walkthrough that you can try to enable smart tags in the Northwind sample database in Access 2003.

Note   This procedure will modify the Northwind sample database provided with Access 2003. It is recommended that you make a copy of the database and use the copy in this walkthrough. In a default installation of Access 2003 , the Northwind sample database is installed at C:\Program Files\Microsoft Office\OFFICE11\SAMPLES.

  1. Start Access 2003.

  2. Open the Northwind sample database by pointing to Sample Databases on the Help menu, and then clicking Northwind Sample Database.

  3. Click Tables on the Objects list, click the Employees table, and then click Design.

  4. Click the LastName field.

  5. Under Field Properties, click Smart Tags, and then click the ellipses (...).

  6. The Smart Tags dialog box displays smart tags that are installed on your system including default name and address actions.

    Figure 1. Smart Tags dialog box

  7. Select the Person name check box. Notice that the Smart Tag Details section displays the available smart tag actions. There is also a More Smart Tags button that connects you to the Microsoft Office Web site to find more information about smart tags.

  8. Click OK to close the Smart Tags dialog box. Notice that in the Smart Tags field, the smart tag selection you made inserted "urn:schemas-microsoft-com:office:smarttags#PersonName". This is a semicolon-separated list (assuming that you selected more than one smart tag) of smart tag names, which use the format namespaceURI#tagname.

  9. Open the Employees table in Datasheet view, saving the changes to the table when prompted. Notice the triangular-shaped object in the corner of the LastName field. This is a visual indicator that alerts users that smart tags are enabled for the field.

  10. To call an action for this smart tag, rest the mouse cursor over the triangle, and then move the cursor over to the square icon. Click the arrow to the right of the icon and select one of the actions.

  11. Close the Employees table.

    Figure 2. Smart tag indicator on the LastName field

Smart Tags and Existing Dependent Objects

Next, you can open the existing Employees form to see what, if any, changes resulted from adding a smart tag to the LastName field in the table. The Employees form is dependent on the Employees table for data.

  1. Click Forms under Objects, and then double-click the Employees form.
  2. Looking at the form's LastName field, notice that the field is missing the smart tag indicator that you saw when you viewed the LastName field in the Employees table. This confirms that setting smart tags on a table does not propagate those settings to any dependent objects. Close the Employees form.

Smart Tags and New Dependent Objects

Now, you can create a new form based on the updated Employees table to see if the smart tag created in the table is carried over to the form.

  1. In the Database window, click Forms under Objects.
  2. Click the New button on the Database window toolbar.
  3. In the New Form dialog box, click AutoForm: Columnar.
  4. Click the Employees table in the drop-down list.
  5. Click OK. The new form is created and displayed.
  6. Looking in the LastName field, you see the smart tag indicator.
  7. Switch the form to Design view and then double-click the BirthDate control to open the Property page.
  8. Click the All tab, scroll down to the SmartTags property, click the field, and then click the ellipses (...).
  9. Select the Date check box and click OK.
  10. Close the Property page, and then open the form in Form view.
  11. Notice that a smart tag indicator is now displayed in the BirthDate field. Save the new form as Employees1.

To summarize so far, an object's smart tags can be enabled by setting the SmartTags property directly on the object or, for dependent objects, recreating the object based on the table or query containing the smart tag.

Figure 3. Form based on Employees table with smart tags

Smart Tag Inheritance with the Save As Option

Next, create a new data access page by using the Save As option and see if the smart tags created so far are inherited by the new page.

  1. With the Employees1 form in Form view, click Save As on the File menu.

  2. In the Save As dialog box, click Data Access Page in the drop-down list under As, and then click OK.

  3. In the New Data Access Page dialog box, keep the default name, and then click OK.

  4. The data access page is created and displayed. Looking at the page, it appears that the form did not carry over the smart tags.

  5. However, rest your mouse cursor over the BirthDate field. Notice that a smart tag icon is displayed. Click the down arrow on the icon. The smart tag's associated actions are displayed.

    Figure 4. Smart tag actions for a date field on a data access page

    Based on the above, we can conclude that smart tag enabled controls can propagate from one dependent object to another dependent object but not from the data source to a dependent object.

    **Note   **As shown in Figure 4, clicking the smart tag icon displays a caption at the top of the list followed by a list of actions. The caption and smart tag actions are contained in a dynamic-link library (DLL). A DLL is a collection of functions grouped into an external file that can be used by other programs.

  6. Smart tag information is embedded in the data access page's HTML. To see this, with the data access page displayed, click HTML Source on the View menu. Looking through the <META> tags, you will see the following code which provides the same namespace and smart tag name information that we saw in the SmartTags property for the Employees table:


The procedures we have looked at so far allow you to add or remove smart tags on an individual control or field basis. You can also enable or disable smart tags for all forms or datasheets.

Enabling or Disabling the Display of Smart Tags

There are two application-level options that allow you to enable or disable smart tags, one to Show Smart Tags on Forms, and one to Show Smart Tags on Datasheets. The settings are available by clicking Options on the Tools menu, and then clicking either the Forms/Reports tab or the Datasheet tab.

Figure 5. Show Smart Tags on Forms option

Figure 6. Show Smart Tags on Datasheets option

Now that you have seen how to work with smart tags through the user interface, let's look at what you can do programmatically.

Setting or Modifying the SmartTags Property Programmatically

In addition to setting the SmartTags property from a Property page or in Design view, you can also set or modify the property programmatically. You essentially use the same methods you use for working with any property in Access. The following samples can be used to set or modify the SmartTags property for tables and forms in Access database (.mdb) and Access project (.adp) files.

Setting or Modifying the SmartTags Property in Tables

Depending on your environment, do one of the following:

  • .mdb support

  • .adp support (this has to be done through T-SQL)

    EXEC sp_addextendedproperty 'MS_SmartTags', 
        'urn:side-bar-com:bar:side#SideBar', 'user', dbo, 'table', 
        Side, 'column', Bar

Setting or Modifying the SmartTags Property in Forms:

This is the same syntax you would use to set or modify properties on other objects.


Programmatically Executing Smart Tag Actions and Other Tasks

Besides settingthe SmartTags property programmatically, you can also add a smart tag, delete a smart tag, execute a smart tag action, and other tasks by using the SmartTags collection object. For example, the statement


runs the first action for the first smart tag of the active control on the first open form. To avoid receiving an error, the control containing the smart tag must have the focus, making it the active control.

Other Pertinent Information

This section lists more useful information about using smart tags in Access:

Which Controls Can Be Smart Tag Enabled?

Form controls

  • Label
  • Text Box
  • Combo Box
  • List Box

Data Page controls

  • Label
  • Bound Span
  • Text Box
  • Scrolling Text
  • Dropdown List
  • List Box
  • Hyperlink

Smart Tag Support in Linked Tables

For linked tables, the SmartTags property is editable. However, if a user changes it, it is only changed in the local copy of that property. Editing does not change the property in the database to which the table is linked.

Converting From Earlier Versions of Access

Whether the SmartTags property is preserved for tables, queries, and dependent objects depends on the version of Access database. In addition, the ability to create new smart tags also depends on the object and the Access version. The following table defines this relationship in more detail.

Beginning format Target format Object Existing smart tags available? Can add new smart tags?
Access 2003 Access 2000 All Yes Yes
Access 2000 Access 97 All Yes Yes
Access 97 1, 2 Access 2000/Access 2003 Table Yes Yes
    Query Yes Yes
    Form No Yes
Access 97 Access 97 (opened in Access 2003) Table Yes No
    Query Yes Yes but can't be saved
    Form No Yes but can't be saved

1 Originally an Access 2000 database converted to Access 97 from Access 2003.

2 Data access pages aren't available for Access 97 databases.

Smart Tag Support in Access Projects

Access projects only support the SmartTags property for forms and data access pages. Support for those objects is the same as for .mdbs.

Access projects store the SmartTags property as an extended property. This means that the SmartTags property cannot be supported in any version of Microsoft SQL ServerTM prior to SQL Server 2000.

The new extended property in SQL Server is named MS_SmartTags. In SQL Server 2000, there is generally no easy way to edit extended properties, which means that the MS_SmartTags property can only be set on tables using T-SQL or with the SQL Enterprise Manager.

Smart Tag Information Not Persisted on Import or Export

The SmartTags property information is not included when exporting to an XML or XSL formatted file. The smart tag property information is saved when exporting a data access page.

What Is Not Supported?

Access 2003 does not support the following smart tag operations:

  • Importing smart tags from Excel.
  • Exporting smart tags to Excel versions 97 through 2002.
  • Exporting smart tags to Rich Text Format.
  • Exporting smart tags to Active Server Pages.

Additional Resources

Below is a list of additional resources where you can get more information on smart tags:


In this article, we have explored the new smart tag feature in Access 2003. I have demonstrated how smart tags can allow you to extend your Access solutions by easily adding additional functionality for your users. You have seen how smart tags can be enabled individually or for all forms or datasheets. You have also seen in which file formats and for which objects smart tags are enabled and can be added. We also looked at some of the limitations of the smart tag feature in Access. However, it should be clear after trying some of the procedures in this article that the benefits of using smart tags in Access 2003 far outweigh any limitations.