Please Help ME!
There's a problem that can't fix the display of a chart with VBA code, that I've found here in the forum at the Reports area; the chart still shows the prior information on record, and don't show the information that is requested.
I tried to put the code on FormLoad and Record Navigation Commands and still don't work..
So, what makes a chart show the requested information?
Here's th post on Reports:
http://www.access-programmers.co.uk/forums/showthread.php?t=67616
and the code to help this situation is:
1) Problem: When the report is previewed or printed, Graph doesn't display the proper data from its record source, instead it displays either the data from a prior record or the sample data in the Graph data sheet:
Solution:
Add the following Visual Basic code to the On Print event of the section of the report that contains the Graph object.
On Error Resume Next
Dim objGraph As Object
Set objGraph = Me!TheNameOfYourGraph.Object
objGraph.Refresh
DoEvents
Set objGraph = Nothing
2) The data in the datasheet and sample data shown in Graph in design view is not the data from the record source specified, rather it is some default sample data; so its hard to properly design the graph.
Solution:
Modify the code above adding the following 5th line shown below, preview the report and save it.
On Error Resume Next
Dim objGraph As Object
Set objGraph = Me!TheNameOfYourGraph.Object
objGraph.Refresh
'This will update the data sheet
objGraph.Application.Update
DoEvents
Set objGraph = Nothing
In the Form this codes don't do anything helpful.. what helps the chart show the correct information[that is requested]?
There's a problem that can't fix the display of a chart with VBA code, that I've found here in the forum at the Reports area; the chart still shows the prior information on record, and don't show the information that is requested.
I tried to put the code on FormLoad and Record Navigation Commands and still don't work..
So, what makes a chart show the requested information?
Here's th post on Reports:
http://www.access-programmers.co.uk/forums/showthread.php?t=67616
and the code to help this situation is:
1) Problem: When the report is previewed or printed, Graph doesn't display the proper data from its record source, instead it displays either the data from a prior record or the sample data in the Graph data sheet:
Solution:
Add the following Visual Basic code to the On Print event of the section of the report that contains the Graph object.
On Error Resume Next
Dim objGraph As Object
Set objGraph = Me!TheNameOfYourGraph.Object
objGraph.Refresh
DoEvents
Set objGraph = Nothing
2) The data in the datasheet and sample data shown in Graph in design view is not the data from the record source specified, rather it is some default sample data; so its hard to properly design the graph.
Solution:
Modify the code above adding the following 5th line shown below, preview the report and save it.
On Error Resume Next
Dim objGraph As Object
Set objGraph = Me!TheNameOfYourGraph.Object
objGraph.Refresh
'This will update the data sheet
objGraph.Application.Update
DoEvents
Set objGraph = Nothing
In the Form this codes don't do anything helpful.. what helps the chart show the correct information[that is requested]?
Last edited: