Managing Linked Shapes


If you never refresh a shape or update a database after creating a link, your shapes will represent a snapshot of the database. However, if you want to keep shapes in sync with the records they’re linked to, Visio makes it easy. When you use the Link To Database command, Visio adds four commands to each shape’s shortcut menu that you can use to manage and update the link, as Figure 24-9 shows. Visio always refers to updating shape properties as refreshing the shape, whereas using the shape’s values to change the database is referred to as updating the database. To refresh or update an individual shape or a database record, right-click a shape, and then choose the command you want.

click to expand
Figure 24-9: When you link a shape to a database record, Visio adds four commands to the shape’s shortcut menu for controlling the connection.

You can also refresh or update all the shapes on a drawing page at once as follows:

  • To refresh all the shapes, choose Tools, Add-Ons, Visio Extras, Database Refresh.

  • To update the database with changes made to the shapes, choose Tools, Add-Ons, Visio Extras, Database Update. Visio prompts you before writing over existing records with a message such as the following:

    click to expand

    Note

    You must have write access to a database for Visio to update the database based on changes in a drawing file.

start sidebar
Troubleshooting
Deleting records from a linked Excel worksheet causes an error

The ODBC driver for Excel does not support row deletion. According to the Database Wizard Samples Readme.txt file provided by Microsoft, Visio circumvents this problem by setting text fields to #ROW DELETED# and numeric fields to 0.

end sidebar

Adding Commands to Update All Shapes at Once

For convenience, you can add commands to the shortcut menu of a page so that you can manage the links for all the shapes on the page instead of those for individual shapes only. The Link To Database command doesn’t provide this option, but the Database Wizard does. If you’ve already used the Link To Database command to set up the links, you can use the Database Wizard to add actions and events to a drawing page. The Database Wizard provides the following options for adding actions and events:

  • Refresh Shapes On Page This action adds the Refresh Shapes command to the shortcut menu of the page. When you right-click the page and choose the command, Visio refreshes all the linked shapes on the page.

  • Update Shapes On Page This action adds the Update Shapes command to the shortcut menu of the page. When you select the command, Visio passes along to the database any changes made to the value of shape properties.

  • Refresh Linked Shapes On Document Open The Open event is technical jargon for when a user opens a drawing file. In this case, you can have Visio refresh all property values for linked shapes every time you open the drawing file.

  • Periodically Refresh Based On NOW Function The NOW function is programming code that creates an event that happens continuously (until you specify otherwise). In this case, the event is refreshing the linked shapes based on database values. If you select this option, Visio adds the Start Continuous Refresh command to the shortcut menu of a page. When you select this command, you create a live link between the drawing file and the database that continues to transfer data until you right-click the page again and choose Stop Continuous Refresh.

Follow these steps to add actions or events to the shortcut menu of a page that contains linked shapes:

  1. Choose Tools, Add-Ons, Visio Extras, Database Wizard.

  2. On the first wizard screen, click Next.

  3. On the next screen, choose Create A Linked Drawing Or Modify An Existing One, and then click Next.

  4. On the next screen, choose Add Database Actions And Events To A Drawing Page, and then click Next.

    click to expand

  5. In the drop-down list, choose the drawing file (.vsd) that contains the linked shapes. If the drawing file is not open, click Browse, locate the file you want, and then click OK.

  6. Under Choose The Drawing Page To Modify, select the page for which you want to modify the shortcut menu, and then click Next.

    click to expand

  7. Select the actions or events you want to add to the page’s shortcut menu, and then click Next.

  8. Review your choices, and click Back to change an option if necessary. Click Finish to add the selected actions and events to the page’s shortcut menu.

Updating Shapes Automatically

You can update linked shapes automatically at regular intervals based on changes that are made to the database. Visio monitors the database at regular intervals called the refresh interval, which you specify in seconds. If the connection takes longer to update than the time you set, Visio adjusts the refresh interval.

Note

When you specify a refresh interval, it applies to all shapes that are connected to a database through the same DSN. Visio refers to this as a “global” setting for this reason.

Follow these steps to update shapes at regular intervals:

  1. Choose Tools, Add-Ons, Visio Extras, Database Settings.

    click to expand

  2. Select the Automatically Refresh Drawing Page check box.

  3. In the Refresh Drawing Interval (Secs.) box, type the number of seconds in the interval, and then click OK.




Microsoft Office Visio 2003 Inside Out
Microsoft Office Visio 2003 Inside Out (Inside Out (Microsoft))
ISBN: 0735615160
EAN: 2147483647
Year: 2003
Pages: 209

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