16.4.1 ProblemIn my application I would like to use the Financial Symbol smart tag so that users will be directed to the Stock Quote on MSN MoneyCentral. I don't want to display the smart tag, which also presents two additional actions this might confuse the user. How can I configure a combo box control so that when the user selects a symbol, the Stock Quote on MSN MoneyCentral is automatically displayed in a browser window? 16.4.2 SolutionThe built-in smart tags that ship with Access are somewhat limited in that they do not allow you to configure them by adding or removing actions. The Financial Symbol smart tag looks up information about a financial symbol on MSN MoneyCentral, allowing you to take the following actions:
In Access, you enable the Financial Symbol smart tag on a field or control that contains a financial symbol the familiar abbreviations seen on stock tickers. To execute only a single action obtaining a stock quote you need to enable smart tags in code by setting a control's SmartTags property. Once you've enabled the smart tag in your code, you can then execute a smart tag action. Once the action executes, you can then disable the smart tag so that it is never displayed to the user. Follow these steps to configure a combo box to use the Financial Symbol smart tag to display a stock quote when the user selects an item:
16.4.3 DiscussionThe SmartTags collection contains one or more SmartTag objects. You can refer to a single SmartTag object in the collection by using the Item method or the index. The collection is zero-based, so the following code fragment refers to the first SmartTag for the ctl control: ctl.SmartTags(0)
The SmartTag object has several properties, such as Application, IsMissing, Name and Property. The SmartTagActions property represents a collection of actions for an individual smart tag. These actions are processes that are programmed into a smart tag as individual SmartTagAction objects. The SmartTagAction object has several properties and a single method, Execute. In this example, the first SmartTagAction in the SmartTagActions collection is executed: SmartTagActions(0).Execute By dynamically assigning a smart tag in code, executing an action, and then removing the smart tag, you can take advantage of built-in smart tag functionality without presenting unnecessary options to the user. |