Solved

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

Posted on 2006-07-17
8
1,228 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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
 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

861 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