How to pass a chart variable to a function

Originally Posted 18 July 2013, 7:39 pm EST

  • Originally Posted 18 July 2013, 7:39 pm EST

    I'm using VBA for Access 2010 to create charts. Since I'm using the same chart on both a form and a report, I thought I would create a function that builds the chart, then call this function from both the form and the report. But I'm not able to pass the chart to the function.
    I have tried

    Public Function initChart(chartResults As Chart2D)

    but I get "Type mismatch" during the call to the function.

    Any ideas?


  • Reply


    There might be some syntactical differences in VBA, that is moreover a non-standard platform for ActiveX chart, standard platforms are VB 6.0 and Visual studio.

    However it works fine on using it in VB 6.0 like

     Call newchart(Chart2D1)
    Private Function newchart(ct As Chart2D)
    ' Line of codes
  • Reply

    I'm able to use OLCH2x8 for the most part in Access forms and reports, but I guess there are some limitations.


Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels