Online Book Reader

Home Category

Access Cookbook - Ken Getz [312]

By Root 2007 0

Local Weather

Your local weather report on MSNBC.

http://msdn.microsoft.com/office

Local Weather Report

-- Get Weather

http://www.msnbc.com/news/wea_front.asp?tab=oth&

czstr={TEXT}&ta=y&accid={TEXT}

Once you've created the Weather.XML smart tag, deploy it by copying or saving it to the following location:

\Program Files\Common Files\Microsoft Shared\Smart Tag\LISTS\

Follow these steps to use the Weather.XML smart tag in Access:

Shut down any running copies of Access that may have been active when you saved Weather.XML to the \Smart Tag\LISTS\ folder. This is necessary to restart the smart tag engine.

Open the Access application (16-06.MDB).

Open the frmCustomers form in design view. Select the PostalCode text box and press F4 to bring up the Properties window.

Click the builder button (...) to bring up the Smart Tag dialog box and select the Local Weather Report option, as shown in Figure 16-8. Click OK.

Figure 16-8. Attaching the custom Weather.XML smart tag

Display the form in form view, scroll through the records, and select the smart tag as shown in Figure 16-9. Select the Get Weather option and you will be redirected to the msnbc.com weather forecast for that zip code.

Figure 16-9. The deployed Weather.XML smart tag

Discussion


Here's how the Weather.XML smart tag file works:

The first line of the XML file defines a smart tag and the smart tag list namespace. In this example, the urn:schemas-microsoft-com namespace is used, but this is not required. You can provide any unique namespace name that you want. You must enclose the entire smart tag within the FL:smarttaglist element:

The next three lines define the name, description, and a URL to get more information about the smart tag by using the , , and elements:

Local Weather

Your local weather report on MSNBC.

http://msdn.microsoft.com/office

The FL:smarttag element's type attribute defines a smart tag type, which is a unique, arbitrary identifier for a smart tag on a user's computer. The smart tag type has two parts: the namespace URI and a tag name:

The URI is conventionally some derivation of your company's name (microsoft-com is used here), and the tag name must consist of the "#" symbol and some unique string (#weather). You could have the same URI with a different tag, say #directions, the combination of which would create a second smart tag type.

The following lines consist of the caption and terms. The caption shows up on the smart tag (see Figure 16-9), and the terms are not needed for Access since it does not require or support the recognizers that are needed when working with smart tags in Word or Excel:

Local Weather Report

The next text block defines the set of actions, or verbs, for the smart tag, which is fully enclosed with an actions element. The actions element contains one or more action child elements. This example has a single action element consisting of a caption element (Get Weather) and a url element, which provides the associated URL for the action, navigating to the www.msnbc.com Web site:

-- Get Weather

http://www.msnbc.com/news/wea_front.asp?tab=oth&

czstr={TEXT}&ta=y&accid={TEXT}

The last two lines in the Weather.XML file close out the FL:smarttag and FL:smarttaglist

Return Main Page Previous Page Next Page

®Online Book Reader