Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report shows incorrect graph data which gets criteria from same report

Status
Not open for further replies.

inso18

Technical User
Dec 30, 2006
147
IL
Hello.

I have something strange going with a graph that is located on the only section [BranchId] of my report[ReportByBranch].

The graph that is set there takes the whole page size, and based on query that takes a criteria from a control of the same report - [Reports]![ReportByBranch]![BranchId]

Now when the query is displayed while the report is open on a certain page, it displays the correct data - using the correct BranchId. But when running the report, for some reason, the data from same query that is displayed on graph uses BranchId from *the following* BranchId. (the one I have to scroll to the next page to see)

Anyone has any experience on why this could be, if it is a bug or how can it be handled.?

Much appreciation for your time,
inso18.
 
Just to add: When I'm located on a certain page of the opened report, and from VBA window I type
Code:
?Reports!ReportByBranch!BranchId
I get the BranchId of the *following* page.

In the report I have Page header, Page footer, BranchId header, BranchId footer, and Detail (where the graph is set). All this takes 1 page.

All 'Force New Page' and 'New Row or Col' set to 'No', all 'Keep Together' set to yes. BranchId 'Group on' is set on 'each value, and 'Group Interval' is set on 1
 
It's a wierd bug in Access. I tried it with many reports. If a report's section is one page long, writing ?Reports!MyReport!ctlControl.value won't ever give the correct control value.
 
I have experienced this in the past. The work-around is to refresh your graph/chart control in the On Format event of the section containing the graph. From the ACGGroup web site:
[tt][blue]
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.

Code:
    On Error Resume Next
    Dim objGraph As Object
    Set objGraph = Me!TheNameOfYourGraph.Object
    objGraph.Refresh
    DoEvents
    Set objGraph = Nothing
[/blue][/tt]

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top