By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 2,006 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

Getting to a Chart's Props?

P: n/a
I've been to
http://msdn.microsoft.com/library/de...itleobject.asp,
but still don't have a clue.

For example, I've got a chart object namde 'grphStats' in a form named
frmChart.

?Forms!frmChart!grphStats.Name returns "grphStats" as expected, but
I can't get any further.

My immediate need is to modify the chart's .Title.
?forms!frmChart!grphStats.Object.Title.Text causes an error 438
"Object doesn't support this property or method."
Anybody know what I am doing wrong?
Nov 13 '05 #1
Share this Question
Share on Google+
22 Replies


P: n/a
On Wed, 04 May 2005 11:18:31 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
Anybody know...


It just got a little more complicated.

Turns out we need to create an indeterminate number of charts.

The background is that we are showing the user a form that contains
various statistics for a fund's returns and a benchmark's returns.
Things like Standard Deviation, Kurtosis, Skewness, Correlation,
Return Risk, Tracking Error, Info Ratio and so-forth.

Those stats are presented in rows that have a column for each of three
periods: 3 years, 5 years, 7 years, and 10 years.

Users click on a cell (say Kurtosis 3 years) and they get a chart
showing the 12-month rolling values for that statistic over the two
years that will fit into the 3-year window before the rolling 12
months spill out.
The users also want to be able to click on one cell, get the chart;
then click on another cell, get the chart; and so-forth.... resulting
in many charts on the screen....

Like the Ginsu ad says, "But wait, there's more...."....

....AND they want to be able to export any of those charts to MS Word,
Excek, and/or PowerPoint.
My one little problem is now three:

1) How to dynamically alter the props of a chart (the original
question)

2) How to dynamically create a form containing a chart without basing
it on a recordset (infiniate number of charts allowed....don't want an
infinate number of work tables...).

3) How to programatically export said chart object to, say MS Word.

Nov 13 '05 #2

P: n/a
On Wed, 04 May 2005 14:18:57 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
2) How to dynamically create a form containing a chart without basing
it on a recordset (infiniate number of charts allowed....don't want an
infinate number of work tables...).

3) How to programatically export said chart object to, say MS Word.


Could the answer to both be embedding an MS Excel object in the
"Chart" form and making the chart in that object - i.e. making it a
Excel chart?
Nov 13 '05 #3

P: n/a
Br
PeteCresswell <x@y.z.Invalid> wrote:
On Wed, 04 May 2005 14:18:57 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
2) How to dynamically create a form containing a chart without basing
it on a recordset (infiniate number of charts allowed....don't want
an infinate number of work tables...).

3) How to programatically export said chart object to, say MS Word.


Could the answer to both be embedding an MS Excel object in the
"Chart" form and making the chart in that object - i.e. making it a
Excel chart?


Have you referenced the Graph library? You can then use the object
browser to check out the correct structure of the Graph object and get
your references correct.

I've done a lot of work with MSGraph from Access to change
Title/Colours/styles/etc.

eg.

Function SetChartTitle(ByRef pGraphObject As Object, pChartTitle As
String)
DoCmd.Hourglass True
Dim MyGraph As Object
Set MyGraph = pGraphObject.Object.Application
On Error Resume Next
MyGraph.Chart.HasTitle = True
MyGraph.Chart.ChartTitle.Text = pChartTitle
MyGraph.Update
Set MyGraph = Nothing
DoCmd.Hourglass False
End Function

SetChartTitle Me![MyGraph], "New Title"

Note: you also have to set "MyGraph.Chart.HasTitle = True"

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #4

P: n/a
Per Br@dley:
I've done a lot of work with MSGraph from Access to change
Title/Colours/styles/etc.


Thanks for the sample code.

I keep forgetting about Object Browser.

Do you have any thoghts on exporting the created chart and/or creating it
without basing it on a recordset?

I'm thinking in terms of putting an MS Excel object in the chart form and
drawing the chart in that Excel environment. Don't know any specifics yet,
but it seems like it should support creating the chart by spoon-feeding it via
an array or something and that exporting it to a .XLS sb pretty straightforwared
too considering it's an Excel-to-Excel thing...
--
PeteCresswell
Nov 13 '05 #5

P: n/a
Br
(Pete Cresswell) <x@y.z.invalid> wrote:
Per Br@dley:
I've done a lot of work with MSGraph from Access to change
Title/Colours/styles/etc.
Thanks for the sample code.

I keep forgetting about Object Browser.

Do you have any thoghts on exporting the created chart and/or
creating it without basing it on a recordset?


I have code that builds a Powerpoint slideshow from a table of charts
usig the cut/paste method.

eg.

rsChart.MoveFirst
Do Until rsChart.EOF
ErrorCount = 0
SetCurrentChart rsChart![ChartID]
'Open chart and copy to clipboard
'NOTE: the form's OnTimer event copies chart to clipboard and closes
form)
DoCmd.OpenForm "frmGraphExport", , , "[ChartID] = " &
rsChart![ChartID], , acDialog
'Create new slide and paste chart as new shape
Set objPPSlide = objPPPresentation.Slides.Add(1, ppLayoutBlank)
With objPPSlide
.Shapes.Paste
.Shapes(1).Left = 40
.Shapes(1).Top = 40
.Shapes(1).Width = 640
End With
rsChart.MoveNext
Loop

You can create a chart unbound on a report/form but you need to build
the chart's datasheet (which is what I do... instead of binding the
chart to a recordset I use the recordset to populate the datasheet.

eg.

'Add series names
row = 1
For col = 2 To FieldCount 'skip first date field
FindSeries = "[SeriesID] = " & rs.Fields(col - 1).Name
rsSeries.FindFirst FindSeries
If Not rsSeries.NoMatch Then
SeriesTitle = rsSeries![SeriesTitle]
MyGraph.Datasheet.Cells(row, col) = SeriesTitle
End If
Next
Set rsSeries = Nothing

'Add data
row = 2
'rs.MoveFirst
Do Until rs.EOF
For col = 1 To FieldCount
If IsNull(rs.Fields(col - 1)) Then
MyGraph.Datasheet.Cells(row, col).ClearContents
Else
MyData = rs.Fields(col - 1)
MyGraph.Datasheet.Cells(row, col) = MyData
End If
Next
rs.MoveNext
row = row + 1
Loop
I'm thinking in terms of putting an MS Excel object in the chart form
and drawing the chart in that Excel environment. Don't know any
specifics yet, but it seems like it should support creating the chart
by spoon-feeding it via an array or something and that exporting it
to a .XLS sb pretty straightforwared too considering it's an
Excel-to-Excel thing...


See above regarding populating the MSGraph datasheet.

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #6

P: n/a
Br
Br@dley <n0****@4u.com> wrote:
(Pete Cresswell) <x@y.z.invalid> wrote:
Per Br@dley:
I've done a lot of work with MSGraph from Access to change
Title/Colours/styles/etc.


Thanks for the sample code.

I keep forgetting about Object Browser.

Do you have any thoghts on exporting the created chart and/or
creating it without basing it on a recordset?

<>

Also, find the MSGraph VBA help file, not installed by default (either
on the Office CD or from the web)

Access97 -> VBAGRP8.HLP

Located in the 'valupack/morehelp' folder on Office97 CD
(how to http://support.microsoft.com/default...b;en-us;161388)

Access2000 -> Vbagrp9.chm

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #7

P: n/a
Per Br@dley:
You can create a chart unbound on a report/form but you need to build
the chart's datasheet (which is what I do... instead of binding the
chart to a recordset I use the recordset to populate the datasheet.


That's where I wanted to go. Before the users said they wanted tb able to
create an undetermined # of charts, I created a work table. Now I can use the
work table for each chart... just build a chart from recs in the table,
re-create the table, and move to the next chart.

Thanks again.
--
PeteCresswell
Nov 13 '05 #8

P: n/a
On Wed, 04 May 2005 22:28:18 GMT, "Br@dley" <n0****@4u.com> wrote:
I've done a lot of work with MSGraph from Access


This is working out pretty well so far.

Thanks again for the sample code.
At the risk of turning into a tarbaby on you: have you had any
problems with the graph not always showing the newly-added data?

Sometimes my graph forms open up and show the populated data but other
times the window opens, but the rendered version of the graph appears
empty.

Seems like if I pause the code and then resume the chances of seeing
the populated graph increase, but it's still not guaranteed.

Tried myGraph.Refresh and myGraph.Requery and even threw in a
DoEvents() - but to no avail.
Nov 13 '05 #9

P: n/a
On Thu, 05 May 2005 11:35:46 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
Sometimes my graph forms open up and show the populated data but other
times the window opens

Stepping through the code, it's like the Graph.Datasheet is going
"Poof!".

Later in the code, I set TitleText, so the pointer to Graph is still
there... but sometimes the cell assignments "stick" and sometimes they
don't.
It's just when I right-click the form's Chart object and select 'Edit'
that I can see that the datasheet is empty - even though
ChartTitle.Text shows the value I assigned to it.

================================================== =
3800 Set chartRS = curDB().OpenRecordset("SELECT StatDate, StatValue
FROM ttblChart ORDER BY StatDate;", dbOpenSnapshot, dbForwardOnly)

3801 With chartRS
3802 If ((.BOF = True) And (.EOF = True)) Then
3803 bugAlert True, "Unexpected empty recordset"
3804 End If
3809 End With

3810 r = 1 'NB: If we try to load row 1, we do not see it
3811 Set fChart = Chart_Open(myTitle)
3819 Set myGraph = fChart!gphStats.Object.Application

3840 With myGraph
3841 Do Until chartRS.EOF = True
3842 r = r + 1
3843 .DataSheet.Cells(r, 1).ClearContents
3844 .DataSheet.Cells(r, 1) = chartRS!StatDate
3845 .DataSheet.Cells(r, 2).ClearContents
3846 .DataSheet.Cells(r, 2) = chartRS!StatValue
3847 chartRS.MoveNext
3849 Loop

3850 .Chart.HasTitle = True
3851 .Chart.ChartTitle.Text = myTitle
3852 .Chart.Refresh
3859 End With

3900 DoEvents
================================================== =
Nov 13 '05 #10

P: n/a
On Thu, 05 May 2005 15:31:17 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
but sometimes the cell assignments "stick" and sometimes they
don't.


Now it seems tb 100% replicable: if I put a break at line 3842, wait
for it to break, remove the break, then hit F5 to continue - the
..DataSheet.Cells() get loaded and I can see it happen on the form.

Without the break/single stepping they don't seem to get loaded.

Same thing if I single-step the code - but then one can see the data
points being added one-by-one.

Seems like I've been here before with some other object, but can't
recall what the problem was.
Nov 13 '05 #11

P: n/a
Br
PeteCresswell <x@y.z.Invalid> wrote:
On Wed, 04 May 2005 22:28:18 GMT, "Br@dley" <n0****@4u.com> wrote:
I've done a lot of work with MSGraph from Access
This is working out pretty well so far.

Thanks again for the sample code.
At the risk of turning into a tarbaby on you: have you had any
problems with the graph not always showing the newly-added data?


Dont feel bad! :)

I had the same problems. It's a bit of a voodoo art to get it right!
Sometimes my graph forms open up and show the populated data but other
times the window opens, but the rendered version of the graph appears
empty.

Seems like if I pause the code and then resume the chances of seeing
the populated graph increase, but it's still not guaranteed.

Tried myGraph.Refresh and myGraph.Requery and even threw in a
DoEvents() - but to no avail.


Try setting the focus to your Chart object before and after you do any
changes... that seems to work for me.

eg. (SetDatasheet is my own function)

Me.Refresh
Me![MyGraph].SetFocus
SetDatasheet Me![MyGraph], Me![ChartID], False
Me![MyGraph].SetFocus
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #12

P: n/a
Br
PeteCresswell <x@y.z.Invalid> wrote:
On Thu, 05 May 2005 11:35:46 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
Sometimes my graph forms open up and show the populated data but
other times the window opens

Stepping through the code, it's like the Graph.Datasheet is going
"Poof!".

Later in the code, I set TitleText, so the pointer to Graph is still
there... but sometimes the cell assignments "stick" and sometimes they
don't.
It's just when I right-click the form's Chart object and select 'Edit'
that I can see that the datasheet is empty - even though
ChartTitle.Text shows the value I assigned to it.


Try what I said before, set the focus to the chart control before doing
anything... and maybe try...

MyChart.Update

Here's my code for changing the title...

Me![MyGraph].SetFocus
SetChartTitle Me![MyGraph], Me![ChartTitle]
Me![MyGraph].SetFocus

Function SetChartTitle(ByRef pGraphObject As Object, pChartTitle As
String)
DoCmd.Hourglass True
Dim MyGraph As Object
Set MyGraph = pGraphObject.Object.Application
On Error Resume Next
MyGraph.Chart.HasTitle = True
MyGraph.Chart.ChartTitle.Text = pChartTitle
MyGraph.Update
Set MyGraph = Nothing
DoCmd.Hourglass False
End Function

Br@dley
================================================== =
3800 Set chartRS = curDB().OpenRecordset("SELECT StatDate, StatValue
FROM ttblChart ORDER BY StatDate;", dbOpenSnapshot, dbForwardOnly)

3801 With chartRS
3802 If ((.BOF = True) And (.EOF = True)) Then
3803 bugAlert True, "Unexpected empty recordset"
3804 End If
3809 End With

3810 r = 1 'NB: If we try to load row 1, we do not see it
3811 Set fChart = Chart_Open(myTitle)
3819 Set myGraph = fChart!gphStats.Object.Application

3840 With myGraph
3841 Do Until chartRS.EOF = True
3842 r = r + 1
3843 .DataSheet.Cells(r, 1).ClearContents
3844 .DataSheet.Cells(r, 1) = chartRS!StatDate
3845 .DataSheet.Cells(r, 2).ClearContents
3846 .DataSheet.Cells(r, 2) = chartRS!StatValue
3847 chartRS.MoveNext
3849 Loop

3850 .Chart.HasTitle = True
3851 .Chart.ChartTitle.Text = myTitle
3852 .Chart.Refresh
3859 End With

3900 DoEvents
================================================== =


--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #13

P: n/a
Br
PeteCresswell <x@y.z.Invalid> wrote:
On Thu, 05 May 2005 15:31:17 -0400, PeteCresswell <x@y.z.Invalid>
wrote:
but sometimes the cell assignments "stick" and sometimes they
don't.


Now it seems tb 100% replicable: if I put a break at line 3842, wait
for it to break, remove the break, then hit F5 to continue - the
.DataSheet.Cells() get loaded and I can see it happen on the form.

Without the break/single stepping they don't seem to get loaded.

Same thing if I single-step the code - but then one can see the data
points being added one-by-one.

Seems like I've been here before with some other object, but can't
recall what the problem was.

Here's my SetDatasheet function in full... hope you can make sense of
it.

Function SetDatasheet(pGraphObject As Object, pChartID As Long,
pExtractData As Boolean)
On Error Resume Next

SetCurrentChart pChartID 'set global user-defined variable to hold
current chart's properties
Dim MySeries As GraphSeries, MyChart As GraphChart, myDB As Database,
rsSeries As DAO.Recordset
Dim MyGraph As Object, MyData As String, SeriesTitle As String,
myChartType As String
Dim rs As DAO.Recordset
Dim row As Long, col As Long, FieldCount As Long
Dim Mseries As Boolean, Qseries As Boolean, Sseries As Boolean,
Tseries As Boolean
Dim FindSeries As String
Set myDB = CurrentDb()
Set rs = myDB.OpenRecordset("qryGraph", DB_OPEN_SNAPSHOT)
Set MyGraph = pGraphObject.Object.Application
Set rsSeries = myDB.OpenRecordset("qrySeriesList", DB_OPEN_SNAPSHOT)
If pExtractData Then

'Clear datasheet
'MyGraph.Datasheet.Cells.Delete
MyGraph.Datasheet.Cells.ClearContents

'If no chart data then quit
If rs.RecordCount = 0 Then Exit Function
FieldCount = rs.Fields.Count
If FieldCount < 2 Then Exit Function

'Add series names
row = 1
For col = 2 To FieldCount 'skip first date field
FindSeries = "[SeriesID] = " & rs.Fields(col - 1).Name
rsSeries.FindFirst FindSeries
If Not rsSeries.NoMatch Then
SeriesTitle = rsSeries![SeriesTitle]
MyGraph.Datasheet.Cells(row, col) = SeriesTitle
'MyGraph.DataSheet.Cells(row, col) = rs.Fields(col - 1).Name
'substitute series name as ID used now for field name
End If
Next
Set rsSeries = Nothing

'Add data
row = 2
Do Until rs.EOF
For col = 1 To FieldCount
If IsNull(rs.Fields(col - 1)) Then
MyGraph.Datasheet.Cells(row, col).ClearContents
Else
MyData = rs.Fields(col - 1)
MyGraph.Datasheet.Cells(row, col) = MyData
End If
Next
rs.MoveNext
row = row + 1
Loop

End If

'Set series plot type
Dim PrimarySeries As Boolean, SecondarySeries As Boolean
Dim Series As DAO.Recordset, S As Long
Set Series = CurrentDb.OpenRecordset("qrySeries", DB_OPEN_SNAPSHOT)
S = 0
Sseries = False
Mseries = False
Qseries = False
Tseries = False
Series.MoveFirst
On Error Resume Next

PrimarySeries = False
SecondarySeries = False
Do Until Series.EOF
S = S + 1

Select Case Series![SeriesType]
Case "Mean": Mseries = True
Case "Questionnaire": Qseries = True
Case "Sales": Sseries = True
Case "Tarps": Tseries = True
End Select

If Series![PlotOnY2] Then
SecondarySeries = True

'Have to do following check else would fail for some reason
If MyGraph.Chart.SeriesCollection(S).AxisGroup <> xlSecondary Then
MyGraph.Chart.SeriesCollection(S).AxisGroup = xlSecondary
Else
PrimarySeries = True
If MyGraph.Chart.SeriesCollection(S).AxisGroup <> xlPrimary Then
MyGraph.Chart.SeriesCollection(S).AxisGroup = xlPrimary
End If
myChartType = Series![SeriesPlotType]
If myChartType <> "None" Then
MyGraph.Chart.SeriesCollection(S).ChartType = GetChartType(myChartType)
Series.MoveNext
Loop

MyGraph.Chart.HasTitle = True
MyGraph.Chart.ChartTitle.Text = GV_CURRENT_CHART.ChartTitle
'set axis titles

If PrimarySeries Then
If GV_CURRENT_CHART.ChartAutoY1Title Then
MyGraph.Chart.Axes(2, 1).HasTitle = True
If Qseries Then
If Mseries Then
MyGraph.Chart.Axes(2, 1).AxisTitle.Text = "%/Mean"
Else
MyGraph.Chart.Axes(2, 1).AxisTitle.Text = "%"
End If
Else
If Mseries Then
MyGraph.Chart.Axes(2, 1).AxisTitle.Text = "Mean"
Else
MyGraph.Chart.Axes(2, 1).AxisTitle.Text = ""
End If
End If
End If
If GV_CURRENT_CHART.ChartAutoY2Title Then
MyGraph.Chart.Axes(2, 1).AxisTitle.Font.Bold = False
If SecondarySeries Then
MyGraph.Chart.Axes(2, 2).HasTitle = True

'MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Tarp"

If Tseries Then
If Sseries Then
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Tarp/Sales"
Else
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Tarp"
End If
Else
If Sseries Then
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Sales"
Else
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = ""
End If
End If

MyGraph.Chart.Axes(2, 2).AxisTitle.Font.Bold = False
End If
End If
Else
If GV_CURRENT_CHART.ChartAutoY2Title Then
If SecondarySeries Then
MyGraph.Chart.Axes(2, 2).HasTitle = True
'MyGraph.Chart.Axes(2, 1).AxisTitle.Text = "Tarp"

If Tseries Then
If Sseries Then
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Tarp/Sales"
Else
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Tarp"
End If
Else
If Sseries Then
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = "Sales"
Else
MyGraph.Chart.Axes(2, 2).AxisTitle.Text = ""
End If
End If

MyGraph.Chart.Axes(2, 1).AxisTitle.Font.Bold = False
End If
End If
End If

If GV_CURRENT_CHART.ChartAutoXTitle Then
If GV_CURRENT_CHART.ChartPeriod = "Monthly" Then
MyGraph.Chart.Axes(1, 1).HasTitle = True
MyGraph.Chart.Axes(1, 1).AxisTitle.Text = "Month"
Else
MyGraph.Chart.Axes(1, 1).HasTitle = True
MyGraph.Chart.Axes(1, 1).AxisTitle.Text = "Week Commencing"
End If
End If

MyGraph.Update

SetDatasheet_exit:
Set MyGraph = Nothing
Set Series = Nothing
Set rs = Nothing
Exit Function

SetDatasheet_err:
Resume SetDatasheet_exit
End Function
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #14

P: n/a
Per Br@dley:
It's a bit of a voodoo art to get it right!


The .Setfocus isn't working for me.

Found an MS NG ("microsoft.public.office.developer.vba") and I'm trolling for
something there - in hopes that somebody from MS will respond.

Been Googling for the past three days and spent about an hour last nite in the
local Barns & Noble trying to find a book that covered MS Graph. Nada. It
really does seem like some kind of black art...
--
PeteCresswell
Nov 13 '05 #15

P: n/a
Br
(PeteCresswell) <x@y.z.invalid> wrote:
Per Br@dley:
It's a bit of a voodoo art to get it right!


The .Setfocus isn't working for me.

Found an MS NG ("microsoft.public.office.developer.vba") and I'm
trolling for something there - in hopes that somebody from MS will
respond.

Been Googling for the past three days and spent about an hour last
nite in the local Barns & Noble trying to find a book that covered MS
Graph. Nada. It really does seem like some kind of black art...


I guess if you are really stuck you could send it to me for a hands on
look......
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #16

P: n/a
Per Br@dley:
I guess if you are really stuck you could send it to me for a hands on
look......


Stuck? "Desperate" is the word that comes to mind... this isn't critical path
yet bc I still have to finish more calcs to feed the graphs - but the day will
probably come before the end of next week.
Do you have DSL or Cable? It's gonna be a beeeeeeg .zip file - even though
I'll trim the back end down to almost nothing.
--
PeteCresswell
Nov 13 '05 #17

P: n/a
Per (PeteCresswell):
It's gonna be a beeeeeeg .zip file


2378 kb tb precise.
--
PeteCresswell
Nov 13 '05 #18

P: n/a
Br
(PeteCresswell) <x@y.z.invalid> wrote:
Per (PeteCresswell):
It's gonna be a beeeeeeg .zip file


2378 kb tb precise.


2Mb.. that's not too bad.

Send it to bradleyATcomcenDOTcomDOTau (It's an old address I don't use
anymore, but it's good for "public" stuff like this).

Give a good description of the problem in the email....
--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #19

P: n/a
Per Br@dley:
Send it to


Sent.
--
PeteCresswell
Nov 13 '05 #20

P: n/a
Per PeteCresswell:
For example...


I've got sample apps that provoke the problem: one in Access 2000 and another in
Access 2003 - So I'm guessing it's not an MS Access bug but rather some little
thing that I'm doing or not doing.

Anybody wants to see a sample (35k zip file) just tell me where to send/post
it.
--
PeteCresswell
--
PeteCresswell
Nov 13 '05 #21

P: n/a
I have also encountered the problem of embedded MSGraph charts not being
fully rendered in the containing app. My theory (and it's only a
theory), is that MSGraph updates its object model (e.g., Series
collection, etc.) on which the actual rendering is based asynchronously
as the Datasheet is modified. This was probably done to make Datasheet
UI interaction more responsive. As a result, if you call
Application.Update before the updating is complete, the container app
gets a partially rendered version of the chart. I'm still in the
process of investigating the best solution, but one that seems to work
is to reactivate the MSGraph engine and do the update "later". In
practice, after I have finished filling in all my Datasheets, I loop
over all the charts again, and redo the Application.Update. Here are
some things I don't yet know: 1) Could I leave out the
Application.Upadte the first time around? 2) Could I do this for each
chart immediately after closing MSGraph the first time, i.e., does
MSGraph finish updating before it closes the first time? I'd love to
hear if any of this rambling majes sense and if it helps.

BTW, I'm using C# to generate charts directly in a PowerPoint slide deck
- MSAccess issues may be different.

Mike A.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #22

P: n/a
Per Mike Abraham:
In
practice, after I have finished filling in all my Datasheets, I loop
over all the charts again, and redo the Application.Update. Here are
some things I don't yet know: 1) Could I leave out the
Application.Upadte the first time around? 2) Could I do this for each
chart immediately after closing MSGraph the first time, i.e., does
MSGraph finish updating before it closes the first time? I'd love to
hear if any of this rambling majes sense and if it helps.

BTW, I'm using C# to generate charts directly in a PowerPoint slide deck
- MSAccess issues may be different.


I've stumbled on my own workaround - using a DAO/JET work table.

I create the work table, then write a record to the work table for each data
point on each graph. A given graph's records are identified by a column in the
table that I load with the parent window's hWnd.

That way: the user can create as many graphs as they want, I still only have to
deal with a single work table, and I can let the graph object populate itself by
setting .RowSourceType=Query and putting some hWnd-specific SQL into the
..RowSource.

Seems like the .DataSheet gets populated once from .RowSource and after that the
underlying table becomes moot. Everybody's happy.

Funny thing though, to get changes to the .Chart object (Axis lables and
so-forth) to take, I still have to instantiate a .DataSheet object and feed it a
dummy row - even so that dummy row never affects or shows up in the "real"
..DataSheet generated using the .RowSoure query. If I don't do that, attempts
to change .Chart props trap out.

This is pretty good: almost no documentation and, apparently no books on the
subject. Can anybody spell J-O-B--S-E-C-U-R-I-T-Y? Next time something like
this comes up, we're gonna be heros.
--
PeteCresswell
Nov 13 '05 #23

This discussion thread is closed

Replies have been disabled for this discussion.