Question Graph Update Event - dispatches asynchronous calls, Really? (1 Viewer)

darbid

Registered User.
Local time
Today, 09:25
Joined
Jun 26, 2008
Messages
1,428
It has been a while for this forum and for MSAccess but I'm back at it updating from Win7 Office 2007 to Win10 Office 2010.

I have a few Microsoft Graph Chart object in a form and I am using the onUpdated event of the chart object. That code looks like this;

Code:
With Me.chart_status.Axes(2)
        .MinimumScaleIsAuto = True
        .MaximumScaleIsAuto = True
        
        Select Case .MaximumScale
            Case Is < 10
                .MajorUnit = 1
            Case Is > 100
                .MajorUnit = 10
            Case Is > 10
                .MajorUnit = 5
        End Select
        .MinorUnitIsAuto = True
        .Crosses = xlAutomatic
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
I am however getting an automation error
Automation Error
The caller is dispatching an asynchronous call and cannot make an outgoing call on behalf of this call
Such an error seems impossible for VBA.

In my research today I found this thread which is unresolved
https://access-programmers.co.uk/forums/showthread.php?t=247776

and then this thread https://access-programmers.co.uk/forums/showthread.php?t=246755 which suggests using the timer. I assume using the time "brings the call back on the right dispatcher" (never thought I would be talking about such things in VBA).

I would prefer not to have to use the Timer as I have more than one graph and thus multiple updates happening.

Could anyone suggest another way?
 

JHB

Have been here a while
Local time
Today, 09:25
Joined
Jun 17, 2012
Messages
7,732
Is it possible for you to post your database with some sample data, + description how to reproduce the error?
 

darbid

Registered User.
Local time
Today, 09:25
Joined
Jun 26, 2008
Messages
1,428
Sure can. I hope this works or in this case does not work. Just start the form.

I did not check if the code in the update event would actually work with the example. But in any case the automation error is thrown.
 

Attachments

  • GraphExample.accdb
    552 KB · Views: 74

JHB

Have been here a while
Local time
Today, 09:25
Joined
Jun 17, 2012
Messages
7,732
..
I did not check if the code in the update event would actually work with the example. But in any case the automation error is thrown.
The code runs and cause the error to pop up.
My question is, why do you've the code under that event, (then having the code under another event, it runs without errors)?
Then I think other events could be used.
 

darbid

Registered User.
Local time
Today, 09:25
Joined
Jun 26, 2008
Messages
1,428
The code runs and cause the error to pop up.
My question is, why do you've the code under that event, (then having the code under another event, it runs without errors)?
Then I think other events could be used.
Laziness (faule Hund ;) ) I suppose I just wanted what worked in 2003/07 to work in 2010 and I don't see any reason why it should not.

I will have to see where the code can be put, but I have a feeling that there is a reason why it is set when the chart updates.
 

JHB

Have been here a while
Local time
Today, 09:25
Joined
Jun 17, 2012
Messages
7,732
Laziness (faule Hund ;) ) I suppose I just wanted what worked in 2003/07 to work in 2010 and I don't see any reason why it should not.
It is seen before that things can be done in an earlier version can cause errors in a later / subsequent version.
The error message looks also a little cryptic and it is not certain it is correct.
..I will have to see where the code can be put, but I have a feeling that there is a reason why it is set when the chart updates.
When the chart updates, something must cause it to update, I would look for that and place the code there.
It could be: On open, on load, on current, click on a button or what ever.
 

Users who are viewing this thread

Top Bottom