'Hi, I am using VBA to manipulate Graph 9.0 on an Access form. I use form buttons to change chartType, rowSource, etc. programatically and format various Graph attributes like colors, fonts, etc. However, there seems to be a lag between the time the rowSource takes affect and when certain attributes become available to my program, such as the SeriesCollection. As an example, when I change from a single series graph to a multiple series graph, I can still only access the 1st series:
cht.RowSource = "qryMultipleSeriesData"
cht.ApplyDataLabels Type:=xlDataLabelsShowValue, LegendKey:=False
For x = 1 To SeriesCollection.Count
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
Even if the Graph has 10 series, it still is registering 1 for the series count from the previously loaded graph. If I choose again the graph with 1 series, the series count is 10 from the previously displayed graph.
If I load the same graph for a second time in a row, it then gets the appropriate number of series.
So, there seems to be some kind of timing issue when the RowSource is changed.
A couple other considerations: 1) The form with the graph is in a sub-form. 2) If I put a breakpoint between the RowSource command and looping though the SeriesCollection I don't get the problem, 3) it's a pretty big Access app.