Solved

Microsoft Graph: Can't access seriesCollection after changing the rowSource

Posted on 2006-07-17
8
1,220 Views
Last Modified: 2008-01-09
'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
               With cht.SeriesCollection(x).DataLabels.font
                    .Name = "Arial"
                    .FontStyle = "Regular"
                    .Size = 8
                 End With
            Next x

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.

Thanks!!!
0
Comment
Question by:neilanjk
  • 5
  • 3
8 Comments
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 500 total points
ID: 17128053
See this link for some tips/code for changing the row source for a graph object.

                 http://www.groupacg.com/ATip.htm#MSG
Hope this helps.
0
 

Author Comment

by:neilanjk
ID: 17132327
Hey....a useful article.  I have tried several of the ideas mentioned, but so far, nothing has solved the problem.  I'll keep trying.
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17133483
Here we go! This link should provide you with the info you need.

             http://support.microsoft.com/?kbid=209993
0
 

Author Comment

by:neilanjk
ID: 17140549
Hi. thanks for the link.  This is useful information and I have tried some of the ideas mentioned, but no luck as of yet.  I'll keep trying....J
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17141262
Educated guess...your problem is somehow related to chart being placed in subform.

Things to try:
1. Requery the subform, not the subform control [syntax:yourSubformName.requery] in the afterUpdate of the subform (not the subform control)
2. make sure you have placed any existing refresh/requery commands outside of any conditional loops (loops that you may or may not enter).
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17141860
Another thing to try for diagnostics only (not a solution):

Try changing the default refresh rate.  May support the assertion that the chart is not being refreshed properly (code in wrong event, etc).

To change the refresh rate go to Tools > Options > Advanced and change the "Refresh Interval (sec)" value to just 1 or 2 seconds.

See if your chart response is any better.
0
 

Author Comment

by:neilanjk
ID: 17143084
Thanks for your latest msgs.....I did an experiment using the 1st link you sent me where you programatically populate the datasheet associated with the graph from a recordset.  So far that seems to be working.  I feel that if you leave it up to the graph to run the associated query, the query takes more time to execute than the availabilty of the graph attribures, such as the SeriesCollection.  You would think that Microsoft would have accounted for this situation?  I am going to accept your first response.  Thanks for the help..Jeff
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 17143581
Jeff,
Glad I could help.

PDB
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now