ACC2: Graph 5.0 Legend Moves Each Time Graph Is Refreshed

ID: Q117613


The information in this article applies to:


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:

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:
  1. View the form in Design view.


  2. 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.


  3. 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


  4. From the Run menu, choose Compile Loaded Modules, then close the module.


  5. Save and then close the form.


  6. Open the form in Form view and move through the records. Note that the legend remains at the bottom of the graph.


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.


REFERENCES

For more information about using OLE Automation, see Microsoft Access, "Building Applications," version 2.0, Chapter 13, "Communicating With Other Applications

For more information on the properties, methods, and objects supported by Microsoft Graph, see the Microsoft Graph Visual Basic for Applications Help file (VBA_GRP.HLP). For details about how to obtain VBA_GRP.HLP, please see the following article in the Microsoft Knowledge Base:

Q128364 ACC2: Microsoft Graph VBA Help File Available on MSL

Additional query words: chart example


Keywords          : kbtool IntpGrph 
Version           : 2.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: April 6, 1999