A Chart on a report displays the incorrect data in Access 2002 (318096)
The information in this article applies to:
- Microsoft Access 2002, when used with:
- the operating system: Microsoft Windows 2000
- the operating system: Microsoft Windows XP
This article was previously published under Q318096
For a Microsoft Access 97 version of this article, see 317155.
For a Microsoft Access 2000 version of this article, see 318079.
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SYMPTOMS
When you preview a report that contains a graph object, you might notice that the graph does not match the data that you expect. The graph may also reference data from a previous record in the report.
This behavior occurs only on computers that are running Microsoft Windows 2000 or Microsoft Windows XP.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. CAUSE
This behavior is caused by a timing problem between Microsoft Access and Microsoft Graph. The data is first transferred from Microsoft Access to Microsoft Graph. Microsoft Graph is responsible for generating the appropriate graph. If Microsoft Graph does not generate and return the graph object while Microsoft Access is formatting the report, the graph object might become disassociated from its recordset. This will cause the graph object to display an unrelated record.
RESOLUTION
To work around this problem, use one of the following methods. NOTE: These methods may not work in all situations.
Method 1: Requery the Graph Object- Open the report in Design view.
- Click the section of the report that contains the graph object, and then click Properties on the View menu.
- In the Properties dialog box, click the Events tab.
- To the right of the On Format property box, click the Build (...) button, click the Code Builder, and then click OK.
- In the On Format event for the section, call the Requery action for the graph object.
For example, if your graph object is named objMyGraph, you would type the following statement to requery the object:
' Replace objMyGraph with the name of your object.
Me!objMyGraph.Requery
Method 2: Use a DoEvents Loop- Create a new module.
- Paste or type the following function into the new module:
Function TestProc()
Dim i As Integer
For i = 1 To 5
DoEvents
Next i
End Function
Because this behavior is related to timing, you may have to increase the number of iterations through the loop. Because the number of iterations to be performed is variable (it is dependent on such things as the complexity of the report, the complexity of the graph, or the number of records), a maximum value is not provided.
- Save and then close the module.
- Open your report in Design view.
- Open the Properties window for the section that contains the graph object, and then select the Events tab.
- For the On Format event, call the TestProc procedure that you created in step 2.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. REFERENCES
Microsoft Access 2002 includes a new charting feature known as the PivotChart view. Microsoft PivotChart technology is more flexible than the technology in Microsoft Graph. Therefore, PivotChart views do not exhibit the same behavior that is discussed in the "Symptoms" section of this article. For additional information about the new features in Microsoft Access 2002, click the article number below
to view the article in the Microsoft Knowledge Base:
295358 ACC2002: What's New and What Are the Enhancements in Access 2002
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbReport kbchart kbnofix KB318096 |
---|
|