Change Chart Type Dynamically

R

rmcompute

I am trying to change a chart dynamically. I have coded the following in
the open event of the report:

Dim XGraph As Object
Set XGraph = Me![OLEUnbound0].Object
XGraph.ChartType = xl3DPie

I receive the message: Run-time error 2771. The bound or unbound object
frame you tried to edit doesn't contain an OLE object. Is it possible to
change the type in this way. If it is not, I do have code to change the
report size for another report programmatically through design mode, is there
code available to change the chart type in this way?
 
D

Duane Hookom

I would try move the code to the On Format event of the report section
containing the chart.
 
R

rmcompute

Thank you. As usual, you were right on. The graph is now working. One
thing I noticed, depending on the choice of graph, more than one will appear
on the screen. Do you know if there a control to limit the amount of graphs
per screen?

Thanks for the help.

Duane Hookom said:
I would try move the code to the On Format event of the report section
containing the chart.

--
Duane Hookom
Microsoft Access MVP


rmcompute said:
I am trying to change a chart dynamically. I have coded the following in
the open event of the report:

Dim XGraph As Object
Set XGraph = Me![OLEUnbound0].Object
XGraph.ChartType = xl3DPie

I receive the message: Run-time error 2771. The bound or unbound object
frame you tried to edit doesn't contain an OLE object. Is it possible to
change the type in this way. If it is not, I do have code to change the
report size for another report programmatically through design mode, is there
code available to change the chart type in this way?
 
D

Duane Hookom

I'm not sure what is causing "more than one". Do you have a record source of
your main report that needs to be deleted or grouped?

--
Duane Hookom
Microsoft Access MVP


rmcompute said:
Thank you. As usual, you were right on. The graph is now working. One
thing I noticed, depending on the choice of graph, more than one will appear
on the screen. Do you know if there a control to limit the amount of graphs
per screen?

Thanks for the help.

Duane Hookom said:
I would try move the code to the On Format event of the report section
containing the chart.

--
Duane Hookom
Microsoft Access MVP


rmcompute said:
I am trying to change a chart dynamically. I have coded the following in
the open event of the report:

Dim XGraph As Object
Set XGraph = Me![OLEUnbound0].Object
XGraph.ChartType = xl3DPie

I receive the message: Run-time error 2771. The bound or unbound object
frame you tried to edit doesn't contain an OLE object. Is it possible to
change the type in this way. If it is not, I do have code to change the
report size for another report programmatically through design mode, is there
code available to change the chart type in this way?
 
R

rmcompute

I ran it again and the duplicates went away. I guess maybe the filtering for
the particular report was not correct. I will monitor to see if it happens
again.

Thanks for the help.

Duane Hookom said:
I'm not sure what is causing "more than one". Do you have a record source of
your main report that needs to be deleted or grouped?

--
Duane Hookom
Microsoft Access MVP


rmcompute said:
Thank you. As usual, you were right on. The graph is now working. One
thing I noticed, depending on the choice of graph, more than one will appear
on the screen. Do you know if there a control to limit the amount of graphs
per screen?

Thanks for the help.

Duane Hookom said:
I would try move the code to the On Format event of the report section
containing the chart.

--
Duane Hookom
Microsoft Access MVP


:

I am trying to change a chart dynamically. I have coded the following in
the open event of the report:

Dim XGraph As Object
Set XGraph = Me![OLEUnbound0].Object
XGraph.ChartType = xl3DPie

I receive the message: Run-time error 2771. The bound or unbound object
frame you tried to edit doesn't contain an OLE object. Is it possible to
change the type in this way. If it is not, I do have code to change the
report size for another report programmatically through design mode, is there
code available to change the chart type in this way?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top