Microsoft KB Archive/117613

= ACC2: Graph 5.0 Legend Moves Each Time Graph Is Refreshed =

Article ID: 117613

Article Last Modified on 11/6/2000

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Graph 5.0

-



This article was previously published under Q117613





SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.

Each time a Microsoft Graph 5.0 object is refreshed, the legend moves to a new location.



RESOLUTION
Although you cannot prevent the legend from moving when the graph is refreshed, you can use OLE Automation to reset the legend's position. See the "Workaround" section later in this article for an example of this technique.



STATUS
Microsoft has confirmed this to be a problem in Microsoft Graph version 5.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
A graph in a Microsoft Access form or report is refreshed when any of the following occurs:


 * If the graph is linked to the data in the form or report, the graph is refreshed each time a new record is displayed.
 * When you press F9.
 * When the form containing the graph is refreshed by Access Basic code or the Refresh macro action.

Steps to Reproduce Problem

 * 1) Open the sample database NWIND.MDB.
 * 2) Open the form Sales By Product in Design view.
 * 3) Double-click the graph object to open it in Microsoft Graph 5.0.
 * 4) From the Insert menu, choose Legend.
 * 5) With the legend selected, choose Selected Legend from the Format menu. Click the Placement tab, then choose the Bottom option button. Choose OK.
 * 6) Quit Graph to return to Microsoft Access.
 * 7) View the form in Form view.
 * 8) Click a record selector button at the bottom of the form to move to another record. Note that the legend moves up the graph when the graph is refreshed. As you move through the records, the legend moves further up the graph.

Workaround
This example continues the example started in the "Steps to Reproduce Problem" section of this article. After completing the steps in that section, follow these steps to use OLE Automation to reset the legend to the bottom of the graph each time the graph is refreshed:

 View the form in Design view. Select the graph object and display the property sheet. Select the OnUpdated property and then click the Build button to the right of the property. Select Code Builder and then choose OK. To specify the top and left positions, enter the following lines in the module:

Me!Embedded13.Object.Legend.Top = 171

Me!Embedded13.Object.Legend.Left = 100

NOTE: The value 171 was obtained by opening the Sales By Product form in Design view, opening the form module, and then entering the following line in the Immediate window:

?Forms![Sales By Product]!Embedded13.Object.Legend.Top  From the Run menu, choose Compile Loaded Modules, then close the module. Save and then close the form.</li> Open the form in Form view and move through the records. Note that the legend remains at the bottom of the graph.</li></ol>

To use this workaround in a report, specify the code in step 11 in the OnFormat property setting of the report section that contains the graph.

<div class="references_section">