Chapter 16. Smart Tags

Have you noticed that in recent versions of Excel some cells have little purple triangles in the lower left corner? When you move the mouse over these cells a symbol appears that you can click to reveal a menu of actions related to the contents of that cell. Similar behavior is available in Word for words with a special purple dotted underline. These special features are smart tags.

Smart tags are a way for applications to provide users with context-sensitive actions related to the data appearing on screen. These actions can be available across multiple applications for the same pieces of data. Smart tags were introduced in Office XP, where you could use them in Word, Excel, and Outlook (with Word as the Outlook email editor or when reading HTML mail). In Office 2003 smart tag capabilities have been extended and now Access developers can also incorporate smart tags into their applications.

If you're already familiar with smart tags from working in Word or Excel, you'll find that the implementation of smart tags in Access is a little different. Unlike the implementation of smart tags found in Word and Excel, Access does not support recognizers. In Word or Excel, special code components called recognizers must be created to distinguish which words provide smart tag actions. Access 2003 allows you to attach smart tags to database fields or form controls. The smart tags appear for any text appearing in datasheet views or forms containing those fields, or in the designated controls.

For added control, the View Forms/Reports tab in the Tools Options dialog box allows you to toggle on or off a setting to Show Smart Tags on Forms.

There are three built-in smart tags that ship with Access 2003:

  • Person Name, which enables users to send email to a contact, schedule a meeting, or edit contact information stored in Microsoft Outlook.

  • Financial Symbol, which enables users to look up information about a company on MSN MoneyCentral based on the company's stock symbol.

  • Date, which enables users to schedule a meeting or display the Outlook calendar based on a particular date.

You can attach one or more of these smart tags to a field or control via the Properties windows in the table designer or the forms designer.

In addition to working with the smart tags that ship with Access 2003, you can also create your own custom smart tags by using a specially formatted XML list or by writing your own smart tag DLL. Smart tag DLLs can be written in Visual Basic 6.0 or in managed code (Visual Basic .NET or C#). By using code to create custom smart tags, you can also take advantage of new features that were added in Office 2003, like dynamic captions, temporary smart tags, and smart tags that expire.

In this chapter you'll learn how to use the smart tags that ship with Access to look up financial data and to access Outlook contacts and scheduling. You'll also learn how to create your own custom smart tags and how to deploy them with your application.