Hi - this is my first post here, but I sure hope one of you geniuses can help me...

I've been pulling my hair out trying to create a graph in a report that can be dynamically altered.

Notes: As a side note, I DO NOT WANT TO USE A BUILT-IN QUERY OBJECT. I'd prefer to do everything in code at runtime.

Problem: I cannot change the datasource because I cannot address the object in code. I continue to receive this error message:
Run-time error '2771':

The bound or unbound object frame you tried to edit doesn't contain an OLE object.
To reproduce this error, follow these steps:
  1. Create a new report in design view
  2. Do NOT assign a recordsource for the report
  3. In the header, insert an object (Microsoft Excel Chart OR Microsoft Graph Chart - both exhibit the same symptoms)
  4. Name the graph OLEGraph
  5. Create a function with the following code:
    Private Sub MakeGraph()    
         Dim objGraph As Object        
         Set objGraph = Me.OLEGraph.Object        
    End Sub
  6. Set the function to run at report_open

My current strategy is to try and alter the values of the datasheet and attempt "refresh" the graph. So far, I cannot get past the error message. Any attempt to set an object equal to the OLE object gives the error message listed above. I've scoured the Internet looking for ways to address the graph object, but I have never been able to do it.

Can anyone assist?