Link to home
Create AccountLog in
Avatar of Annaliese Dell
Annaliese DellFlag for United States of America

asked on

Can't reference a chart in an Access Report

Is it possible to programmatically edit a chart in an MS Access 2000 REPORT using VBA?

Numerous codes produce the same error 2771 The bound or unbound object frame you tried to edit doesn't contain an OLE object.

I can edit the same chart in a form but not in a report even when using the same exact code.

I assume the code is correct since it works in the form.

Thanks in advance.
Avatar of Hamed Nasr
Hamed Nasr
Flag of Oman image

Supply what you have done, a form and report to check!
Avatar of puppydogbuddy
puppydogbuddy

You should be able to display your chart in a form or report using the Chart wizard.
If you are trying to copy a chart object from a form to a report, set the following properties for the graph object:
         Enabled: Yes
         Locked: No
See also these links:
       http://office.microsoft.com/en-us/access-help/CH006366208.aspx
       http://support.microsoft.com/kb/304357
       http://www.access.hookom.net/Samples.htm.

 You can also embed an Access 2000 report or form with a chart in a pivot table view, see:
       http://office.microsoft.com/en-us/access-help/a-new-technique-for-adding-charts-in-access-HA001034600.aspx
     
Avatar of Annaliese Dell

ASKER

Thank you both for replying and Happy New Year!

I want to programmatically edit a chart in a report using VBA in Access 2002.

puppydogbuddy: Thank you for the links but unfortunately nothing new or helpful for me.

set the following properties for the graph object:
         Enabled: Yes
         Locked: No

I don't find these on my report properties.

hnasr: Same exact chart. This code changes the title of the chart when it's in a form but when it's in a report it produces error 2771: the bound or unbound object frame you tried to edit doesn't contain an OLE Object.

Private Sub Report_Open(Cancel As Integer)
    Dim cht As Graph.Chart
    Set cht = Me.Chart.Object
    cht.ChartTitle.Text = "hello"
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
OMG! I can't believe it was that simple! This is GREAT! You wouldn't believe the time I spent on this yesterday.

Problem solved.

Thank you, Helen, and a very Happy New Year to you!
Try your code this way:

Private Sub Report_Open(Cancel As Integer)
Dim cht as Object
Dim objDataSheet as Object

Set cht = Me!WhateverchtObjectName.Object
Set objDataSheet = cht.Application.DataSheet

End Sub
oops! did not refresh my browser.
Is there a way to make a chart in a report disappear based on the value of a textbox? I pose the same question for a subform.