I have a subform which sets the RowSource of a Microsoft Chart 5.0 object in its parent form.
EDIT: The Row Source Type for the graph is Value List.
The graph does not paint itself, however, but any action which would generally generate a repaint (drag another Access window over it, minimize it, loss and regain of focus sometimes) doe开发者_高级运维s indeed repaint it. In other words, the graph doesn't show or change automatically.
How do I force a repaint of the chart after a subform action?
These have had no effect:
parent.Referesh
parent.Repaint
parent.TheChart.Refresh
And this does not seem to exist, unfortunately:
parent.TheChart.Repaint
Using: Access 2003
The problem isn't the repainting of the graph. Most likely, the subform that you are using is retrieving data from a query or table.
You must update the values on the "datasource" object, which is providing the subform data (either a query or a table). Then, re-query the graph object in the mainform.
I made a very simple example in my MS-Acess 2000 and it worked great:
- A table (
t01_fruits
) with three columns (frt_id
,frt_name
,frt_qty
). - A subform based in the t01 table.
- A mainform with the previous subform inside, a pie-chart based on table
t01_fruits
and a button. In theOnClick
event of the button, I put justme.graph1.requery
.
When I update the fruits quantity in subform, inside mainform, nothing happens with the graph. When I click the button, the graph is updated correctly.
I also faced same problem in refreshing chart after updating information in form. I got it resolved by re-queering the chart after update of the inbox linking to change of data.
Private Sub txtFinAgreeEnacDt_BeforeUpdate(Cancel As Integer)
Me.graphCRMStatus.Requery
end sub
Private Sub txtFinAgreeEnacDt_AfterUpdate()
Me.Requery
End Sub
Me is the Form holding graph....
I had similar problem like this, having main page with sub-forms, including 2 with graphs - and solution to refresh it was like this:
me.subForm.Requery
me.subForm!Graph1.Requery
Only when you execute commands in this order, it would update graph properly.
I know it's been a while since question was asked, but in case anyone else has issue like this.
精彩评论