How to get the "Chart" object in an Access Form from VBA (Without using ActiveChart)
Posted on 2005-04-22
I'm creating a program with RSView32. It allow me to create some code with VBA.
I've created an Access file to be able to produce my reports. I have to change the
Minimum and Maximum value for the Y Axis of my chart with my code.
I can't figure out how i can reach my Axis. I'm stuck because i can't get this Chart
Dim AppAccess As New Access.Application
Dim f As Form
Dim chart as Graph.Chart
Dim o As Object
Set f = AppAccess.Forms("TREND_FT_PEROX")
Set chart = f.Controls(0) ' I know that my chart is at index 0. But this cause an error.
Set o = f.Controls(0) ' This doesn't cause any error.
It keep telling me "Can't find project or library".
As soon as i get that object, i'll be able to reach the Axis and Scaling of my axes and i'll be able to change my minimum and maximum value. But please, keep in mind that i can't use "ActiveChart"... i must open my Access file from my VB code, then open my form, then access my chart, then access my axis, then my minimum and maximum properties.
Thanks for your help.