emorris1000
Registered User.
- Local time
- Today, 15:09
- Joined
- Feb 22, 2011
- Messages
- 125
I have been having some strange problems with graph errors that can be found here:
http://www.access-programmers.co.uk/forums/showthread.php?t=245033
(not necessary to read to help with problem, unless you want to try and tackle the underlying bug.)
Now, I've found a workaround that fixes the problems with the graphs (there are two graphs that cause problems). I simply have to wait until the graph has been drawn incorrectly and then I run this code:
Right now this is called by a shortcut menu command. This ensures that the graph has been drawn. Also, if there is no data the subform these graphs are on is set to not be visible.
Now, I want to make this event driven so the user doesn't have to run the command each time they load this form. I tried using the "On Updated" event for one of the graphs, which would then call this code, but I got the following error:
"Automation Error
The caller is dispatching an asynchronous call and cannot make an outgoing call on behalf of this call"
This error seems to get called for a variety of lines surrounding this, seems to be anything that is pointed to the chart.
Anyways. I don't know what is causing this error. It seems like on of those "deep errors" that is beyond some simple coding. So what I need is some kind of delayed event that will ensure that the graph is fully loaded before it calls this event.
I've added .isvisible booleans to ensure the graph is visible before calling it, but this did nothing (error gets thrown at the boolean.)
Any thoughts?
Edit: Ok wow so seconds after I posted this I fixed it. I need to pre-type these problems in notepad and then look at the problem again before I post them.
Anyways, the fix was to move the FixGPCGraphs function call from an event tied to the GPC graphs to directly after I made the GPC graph page visible, which is an event in the parent form.
whelp. I'm feeling quite happy.
Still though, if anyone has any ideas how to fix the underlying graph problem (see link) let me know. I think it has to do with drawing log axes, but I'm not sure.
http://www.access-programmers.co.uk/forums/showthread.php?t=245033
(not necessary to read to help with problem, unless you want to try and tackle the underlying bug.)
Now, I've found a workaround that fixes the problems with the graphs (there are two graphs that cause problems). I simply have to wait until the graph has been drawn incorrectly and then I run this code:
Code:
Public Function FixGPCGraphs(GraphName As String)
Dim objChart As Object
Dim objAxis As Object
Select Case GraphName
Case "GPC1"
Set objChart = Forms![TGeneralChar]![SubGPCData].Form.Graph18.Object
Set objAxis = objChart.Axes(1)
objChart.PlotOnX = 0
objAxis.ScaleType = xlScaleLogarithmic
Case "GPC2"
Set objChart = Forms![TGeneralChar]![SubGPCData].Form.Graph23.Object
objChart.PlotOnX = 0
End Select
End Function
Right now this is called by a shortcut menu command. This ensures that the graph has been drawn. Also, if there is no data the subform these graphs are on is set to not be visible.
Now, I want to make this event driven so the user doesn't have to run the command each time they load this form. I tried using the "On Updated" event for one of the graphs, which would then call this code, but I got the following error:
"Automation Error
The caller is dispatching an asynchronous call and cannot make an outgoing call on behalf of this call"
This error seems to get called for a variety of lines surrounding this, seems to be anything that is pointed to the chart.
Anyways. I don't know what is causing this error. It seems like on of those "deep errors" that is beyond some simple coding. So what I need is some kind of delayed event that will ensure that the graph is fully loaded before it calls this event.
I've added .isvisible booleans to ensure the graph is visible before calling it, but this did nothing (error gets thrown at the boolean.)
Any thoughts?
Edit: Ok wow so seconds after I posted this I fixed it. I need to pre-type these problems in notepad and then look at the problem again before I post them.
Anyways, the fix was to move the FixGPCGraphs function call from an event tied to the GPC graphs to directly after I made the GPC graph page visible, which is an event in the parent form.
whelp. I'm feeling quite happy.
Still though, if anyone has any ideas how to fix the underlying graph problem (see link) let me know. I think it has to do with drawing log axes, but I'm not sure.
Last edited: