I have a form with a graph Object (access 2007). The graph has 2 series in it, lets saya "SumOfA" and "SumOfB". I want to dynamically via vba change the legend to "My legend A" and "My legend B" respectivley. It seems that you cannot change the legend withour changing the series name. The series name i.e.(SumOfA and SumOfB) are derived from an acces query and I choose not to change them. I reaserched and found that I can intercept the datasheet which appears to be built as an intermediate table.
So I placed a click button on my from which execuets the follwing code:
Me.Graph5.Object.Application.chart.Application.datasheet.range("A0").Value = "MyLegendA"
AND YES it works perfect, the graph automatically requeryed the datasheet and updated the legend.
Now remeber....I said 2 series!
so I placed another button on the form for the second series, the code is as follows:
Me.Graph5.Object.Application.chart.Application.datasheet.range("B0").Value = "MyLegendB"
PERFECT AGAIN! Here is the rub.
when I place both lines of code to execute with 1 single Click Button, Only the LAST change will occur. I assume that's because the datasheet is automatically requerying between the the 2 lines of code, thus the first change occurs, and then gets clobbered when the second line executes.
Is this assumption corrects? and has any one a suggestion, work around ?
terence
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar