ACC2000: A Chart on a Report Displays the Incorrect Data (318079)
The information in this article applies to:
- Microsoft Access 2000, when used with:
- the operating system: Microsoft Windows 2000
- the operating system: Microsoft Windows XP
This article was previously published under Q318079 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
For a Microsoft Access 97 version of this article, see 317155.
For a Microsoft Access 2002 version of this article, see 318096.
SYMPTOMS
When you preview a report that contains a graph object, you may notice that the graph does not match the data that you expect to appear. The graph may also reference data from a previous record in the report.
This behavior occurs only on computers that are running Windows 2000 or 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 then return the graph object while Microsoft Access is formatting the report, the graph object may become disassociated from its recordset. This causes 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 Build (...), click 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, 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 that must be performed is variable, a maximum value is not provided. The number of iterations is dependent on such things as the complexity of the report, the complexity of the graph, or the number of records.
- 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 click 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.
Modification Type: | Major | Last Reviewed: | 6/23/2005 |
---|
Keywords: | kbbug kbnofix KB318079 |
---|
|