Programmitically altering Graph Properties

InQuery2004

Registered User.
Local time
Today, 11:38
Joined
Nov 12, 2004
Messages
24
Hi Pat,

I'm not sure whether you'll be able to help me out with this problem, but given your seniority on this forum, not to mention your expertise with most things Access, you're as good a person to hassle as any.


I was wondering wherther you're familiar with MS Graphs and programmatically altering their properties. To be specific, I was wondering if, given a graph generated from the wizard, I could add an event procedure that can change some fundamental properties of the graph and refresh the graph in realtime. So for instance, supposing I have a form loaded containing the graph (2D Column type) plotted for Quantity vs. Item No., by clicking a button, I can recreate the graph for Quantity plotted vs. Date or some other field given in the Graph's RowSource.

If you aren't sure how to resolve this problem, would you at least no whether it's a practical solution and where I can learn more about programming graphs in VBA? How would you go about solving this problem, or would you bypass the issue altogether and just generate a separate graph for each parameter on the X-axis??

Thanks so much for your help.

Regards,

Michael J.
 
Last edited by a moderator:
In general it is a poor idea to specifically address a member in your topic. Others, who may know the answer, will simply ignore the post thinking that it is some continuation of another post.

I have never done it but it is possible to modify or create charts from scratch with code. However, look into the Pivot chart since that may work for you without any coding.

PS, I'm going to change your thread subject if I can.
 
Now trying to Refresh the Graphs...

Pat,

Thanks for the response. I fully acknowledge your first point. Normally, this is not my practise either. However, desperate times called for desperate measures, as none of the regulars or guests replied to my original post (Titled along the same lines). This may be a reflection of the complexity of my problem, but I don't even know where to start looking...

As far as changing the subject of my post, that's fine by me and you have every right to do so.

In any case, I have since abandoned the idea of replotting a Graph on the form for new Field values.

I now will implement 3 separate graphs (one for each variable being plotted).

However, this has given rise to altogether separate problem:

For each Graph Object found on the form, I would like to refresh the graph by simply clicking on it. The reason for this is that, I also have some combo boxes on the form that, when changed, update some queries that supply information for the graph (serve as the Rowsource).

I tried to refresh the graphs by "repainting" them in a Macro, however I was dissapointed to find this doesn't work because they're OLE objects?

Is there another way to dynamically refresh or replot a graph?

Thanks again for your time and help.

Regards,

Michael J.
 
I think the .Refresh method is what you need eg

Code:
Me.Graph1.Refresh

which would be in your Graphs OnClick event
 
Hi Richary,

Thanks for the suggestion. I tried your recommended solution, unfortunatley it failed to update/refresh the graph for the new selected data in the combo box.

Do you have any other suggestions for me to try?
 
Download the graphsamp from the Knowledge base to see if there's an example you can use
 
I would suggest you do a search of the forum, I am sure there was a thread recently on this topic. I can't recall the member's name, but I think she was in Australia.
 
Actually,

Rich's solution worked fine (Me.Graph19.Refresh). I mistakingly kept a macro in the event "click" rather than chaning it to the VBA code. The Graph object now refreshes quite nicely.

Thanks for all those who responded.

Regards,

Mike J.
 

Users who are viewing this thread

Back
Top Bottom