Microsoft Office 2003 Smart Tag Software Development Kit
Smart Tags in Microsoft Office Access [Office 2003 SDK Documentation]
Unlike in other Microsoft Office programs, Microsoft® Office Access cannot recognize smart tags dynamically. You have to enable a smart tag for a field or control. The smart tag will then be available regardless of the contents of the field or control.
Because Access does not support the dynamic recognition of smart tags, you don't need to implement the ISmartTagRecognizer or ISmartTagRecognizer2 interfaces if you build a smart tag for use only in Access. However, you must implement the ISmartTagAction interface for all smart tags and, if you want to take advantage of the smart tag features introduced in the Microsoft Office 2003 Editions, you can also implement the ISmartTagAction2 interface.
Access allows you to extend the functionality of a database by assigning smart tags to fields and controls so that the actions associated with that particular smart tag are available to users. Table fields and controls on forms and data access pages now have a new property called Smart Tags for specifying one or more smart tags to be associated with the field or control. Reports also have the Smart Tags property, but the smart tag will be available only if you save the report as a data access page.
Enable or disable smart tags for all forms or datasheets
There are two options in Access that allow you to enable or disable smart tags: one to show smart tags on forms, and one to show smart tags on datasheets. To enable or disable smart tags in forms, do the following:
- On the Tools menu, click Options.
- In the Options dialog box, click the Forms/Reports tab.
- Select or clear the Show Smart Tags on Forms check box.
To enable or disable smart tags on tables in Datasheet view, do the following:
- On the Tools menu, click Options.
- In the Options dialog box, click the Datasheet tab.
- Select or clear the Show Smart Tags on Datasheets check box.
How to enable smart tags for a particular field in a database
The following steps demonstrate how to enable and use smart tags in the Northwind sample database in Access. These steps use a smart tag that is included with Office by default.
Caution Because this procedure modifies the Northwind sample database, you should make a backup copy of this database before carrying out these steps. By default, the Northwind sample database is installed in the c:\Program Files\Microsoft Office\OFFICE11\SAMPLES folder.
- Start Access 2003.
- On the Help menu, point to Sample Databases, and then click Northwind Sample Database.
- In the Northwind : Database window, on the Object list on the left, click Tables, select the Employees table, and then click Design.
- In the Employees table, click the LastName field.
- In Field Properties, click Smart Tags, and then click the build button ().
The Smart Tags dialog box is displayed. The Available Smart Tags list box displays smart tags that are installed on your computer. (Clicking More Smart Tags will take you to a list of smart tags available on Microsoft Office Online.)
- Select the Person name check box. (Note that the Smart Tag Details section displays the available smart tag actions.) Click OK.
The Smart Tags field now shows the smart tag type for the selected smart tag "urn:schemas-microsoft-com:office:smarttags#PersonName".
Note If you select more that one smart tag in the Smart Tags dialog box, the different smart tags are listed in the Smart Tags property box, separated by semicolons.
- Open the Employees : Table in Datasheet view (on the View menu, click Datasheet View), and save the changes to the table when prompted. Note the smart tag indicator in the lower-right corner of the LastName field. If you rest the mouse pointer on the smart tag indicator, a smart tag action button is displayed. Click this button to see the available smart tag actions.
- Close the Employees : Table window.
Importing and exporting operations with smart tags in Access
Microsoft Office Access 2003 does not support the following importing or exporting operations:
- Importing smart tags from Excel
- Exporting smart tags to versions of Excel earlier than 2003
- Exporting smart tags to Rich Text Format
- Exporting smart tags to Active Server Pages
The Smart Tags property information is not included when database object are exported to an .xml or .xsl file. This information is saved, however, when objects are exported to a data access page.
Smart tags and dependent objects
When you assign smart tags to a field in a table or query, smart tags are not automatically associated with the corresponding field in any existing forms or data access pages that are based on the table or query. You need to set the Smart Tags property on any controls in dependent objects yourself, or recreate any dependent objects after you have configured the Smart Tags property of the table or query.
For example, if you create a new form based on the Employees table after smart tags are enabled for the LastName field in that table, smart tags will be enabled automatically for the text box control on the form that corresponds to the LastName field.
Smart tags and conversions between versions of Access
Whether the Smart Tags property is preserved for database objects after conversions from one database format to another depends on the versions of the Access. In addition, the ability to create new smart tags depends on the object and the Access version. The following table illustrates these relationships.
| Conversion | Object | Existing smart tags available
| Smart tags can be added
|
|---|
| Access 2003 to Access 2000 | Table | Yes | Yes |
| Query | Yes | Yes |
| Form | Yes | Yes |
| Access 2000 to Access 97 | Table | Yes | Yes |
| Query | Yes | Yes |
| Form | Yes | Yes |
| Access 97¹ to Access 2000/2003 | Table | Yes | Yes |
| Query | Yes | Yes |
| Form | No | Yes |
| Access 97 database opened in Access 2003 | Table | Yes | No |
| Query | Yes | Yes (but can't be saved) |
| Form | No | Yes (but can't be saved) |
¹Originally an Access 2000 database converted to Access 97 in Access 2003.
Note Data access pages aren't available for Access 97 databases.
Smart tags in linked tables
The Smart Tags property in linked tables can be edited. If a user changes the Smart Tags property of a field in a linked table, however, the change affects only the local copy of the table. The property in the database to which the table is linked remains unchanged.
Smart tags in Access projects (.adp files)
In Access project files (.adp), you can set the Smart Tags property on fields and controls in forms, reports, and data access pages as you would for these objects in .mdb files. The Smart Tags property for tables, however, is not available in Design view in Access projects. In order to use smart tags with tables in Access projects, you can add a Smart Tags property to a field as an extended property.
Note Versions of Microsoft® SQL Server™ earlier than 2000 do not support extended properties.
To add a smart tag to a table in an Access project, use the stored procedure sp_addextendedproperty to create the MS_SmartTags property and set the property to the same smart tag namespace value that you would in the Smart Tags property of a table in an .mdb file.
The following example creates a stored procedure that can be run to add the PersonName smart tag to the LastName field of the Employees table in the NorthwindCS SQL Server database:
CREATE PROCEDURE dbo.AddPersonNameToEmployees AS
EXEC sp_addextendedproperty 'MS_SmartTags', 'urn:schemas-microsoft-com:office:smarttags#PersonName',
'user', dbo, 'table', Employees, 'column', LastName
For more information about sp_addextendedproperty, see SQL 2000 Books Online.
Controls that can be associated with smart tags
Controls on forms:
- Label
text box
- Combo box
- List box
Controls on data access pages:
- Label
- Bound span
- Text box scrolling
- Text dropdown
- List
- List box
- Hyperlink
Note Reports also have the Smart Tag property, but you can interact with smart tags in a report only if you save the report as a data access page.