How to Repaint Microsoft Chart in Access form
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.
MPelletier
Developer with 15 years of experience. I work with J, C, C++, C#, VB.NET ASP.NET, SQLite, MySQL, VBA, and a bunch of other odds and ends.
Updated on June 04, 2022Comments
-
MPelletier almost 2 years
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) does 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