Working with Object Dependencies and Access Smart Tags

graphics/new.gif

In earlier versions of Access, changing a table field's property value such as the Format or Input Mask specification often wreaked havoc on other Access form and report objects that depend on the field. Typically, you bind form and report control objects, such as text boxes, to fields of a table or query. In Access terminology, the control objects inherit the properties of the underlying table fields.

Note

Technically, control objects don't support inheritance as defined by standards for object-oriented programming. Instead, control objects contain a copy of the property values of the source field. The copied properties aren't automatically updated when you change the source field's property values.


Enabling and Viewing Object Dependencies

Access 2003 offers a new feature, called object dependencies, which enables field property change propagation to dependent objects, such as queries, forms and reports. Before you can use change propagation, you must generate dependency data for your database. The version of Northwind.mdb included with Access 2003 doesn't have the required hidden object dependency table. To enable the object dependency feature in Northwind.mdb, do this:

  1. Close all open Northwind objects except the Database window.

  2. graphics/table_wizard.gif Select a table, such as HRActions, in the Database window, and choose View, Object Dependencies or right-click the table entry and choose Object Dependencies.

  3. Click OK in the message box that asks if you want to update object dependencies (see Figure 5.34).

    Figure 5.34. Before you can display object dependencies, you must generate a hidden dependency table for the current database.

    graphics/05fig34.gif

After a few seconds, the task pane displays the dependencies for the selected table, HRActions for this example. The Employees table depends on the HRActions table because of the relationship you created in the earlier "Establishing Relationships Between Tables" section (see Figure 5.35). Some types of objects, such as union queries (Query: Customers and Suppliers by City) and SQL-specific queries (Query: Products Above Average Price), don't support dependency tracking, so they are ignored. When you select the Objects That I Depend On option, the Employees table appears, but the Ignored Objects node disappears from the list.

Figure 5.35. The Employees table depends on the HRActions table, and vice-versa, because of the one-to-many relationship between the EmployeeID fields of the two tables.

graphics/05fig35.jpg

Note

Field property change propagation doesn't apply to changing the Name property of a field. Access 2000+'s Name AutoCorrect feature propagates field name changes. As mentioned earlier in the "Altering Fields and Relationships" section, Track Name AutoCorrect must be enabled to generate object dependency data and enable viewing of dependencies in the task pane.


At this point, no queries, forms, or reports depend on the HRActions table. To view multiple object dependencies, select the Customers table and choose View, Dependencies. One table, three queries, five forms, and a report depend on the Customers table (see Figure 5.36). Click the + symbol for a dependent object to display that object's dependencies in a tree view.

Figure 5.36. Multiple Access objects depend on the Customers table. The Orders table has even more dependencies than the Customers table.

graphics/05fig36.jpg

Activating the Access Property Options Smart Tag

graphics/new.gif graphics/smart_tag_icon.gif Access uses a special-purpose Property Options smart tag to propagate altered field property values. To activate this smart tag, open the Customers table in Design view, temporarily change the Input Mask property value from >LLLLL to >LLLL. When you move the cursor to the Caption field, the smart tag icon appears to the left of the property value text box (see Figure 5.37). Moving the mouse pointer over the icon changes its color, exposes a drop-down arrow and adds a Property Update Options screen tip. Clicking the arrow opens the single option Update Input Mask Everywhere CustomerID is Used. Don't click the option in this case; return the Input Mask property to its original value, which causes the smart tag option to disappear. Close the table without saving your changes.

Figure 5.37. Changing the value of a table field property and moving the cursor to a different property displays the Access Property Options smart tag icon.

graphics/05fig37.jpg

Tip

If you click the option, you must repeat the process with >LLLLL as the Input Mask to return the objects to their original condition.


Figure 5.38. Opening the Property Options' drop-down list displays the single option that updates dependent objects with the altered property value.

graphics/05fig38.jpg

Note

The object dependencies feature and Property Options smart tags aren't available in Access data projects (ADP) or data access pages (DAP).


Adding an Internet-Based Smart Tag to a Field

graphics/new.gif

graphics/smart_tag_icon.gif Access 2003 also supports smart tags linked to Web pages. The only Web-based smart tag included with the product is Financial Symbol, which links to stock quotes, company reports, and recent company news from MSN MoneyCentral. To give this smart tag a test drive, do the following:

  1. graphics/design_view.gif Create a new table with a field named Symbol and, optionally, another field named Company.

  2. Select the Symbol field, move the cursor to the Smart Tags property's text box and click the builder button to open the Smart Tags dialog.

  3. Mark the Financial Symbol check box (see Figure 5.39), and click OK to add "urn:schemas-microsoft-com:office:smarttags#stockticker" as the SmartTags property's value.

    Figure 5.39. Records in a table with a Smart Tag property value specified for a field have an identifier in the lower right corner of the field and display a smart tag icon when selected.

    graphics/05fig39.gif

  4. graphics/datasheet_view.gif Change to Datasheet view, and add a few NASDAQ and New York Stock Exchange stock symbols to the Symbols field. As you add symbols, a triangular marker is present at the bottom right of the cell and a smart tag information icon appears adjacent to the cell.

  5. graphics/smart_tag_option.gif Move the mouse pointer over the icon, and click the arrow to open the Smart Tag Options list (see Figure 5.40).

    Figure 5.40. Selecting the smart tag icon and opening its drop-down list displays the available smart tag actions.

    graphics/05fig40.gif

  6. Select one of the options Stock Quote on MSN MoneyCentral for this example to open the specified Web page (see Figure 5.41).

    Figure 5.41. The MSN Money site displays the current Microsoft (MSFT) stock quotation.

    graphics/05fig41.jpg

Custom smart tags, such as Financial Symbol, are defined by XML documents. The urn:schemas-microsoft-com:office:smarttags#stockticker property value is the Universal Resource Name (urn) for the custom smart tag type attribute value. The corresponding custom smart tag is defined by the Stocks.xml document in Windows XP's \Program Files\Common Files\Microsoft Shared\Smart Tag\Lists\1033\folder (for the U.S. English locale). Navigate to and double-click Stocks.xml to open the document in Internet Explorer (see Figure 5.42). The three <FL:action> elements define the action options you see when opening the list (refer to Figure 5.40).

Figure 5.42. These elements of the Stocks.xml document generates the fixed list (FL) for the MSN Money Financial Symbols smart tag.

graphics/05fig42.jpg

Note

graphics/globe.gif

Creating custom smart tags is beyond the scope of this book. If you want to learn more about Microsoft smart tag technology, go to http://msdn.microsoft.com and search for "smart tag" with the double-quotes included in the search term.




Special Edition Using Microsoft Office Access 2003
Special Edition Using Microsoft Office Access 2003
ISBN: 0789729520
EAN: 2147483647
Year: 2005
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net