Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-07-17
8
Medium Priority
?
1,246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 2000 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
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

660 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