Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Unanswered: Change graph title with code

    I posted this question on Utter Access and Access World Forums several days ago and have not received a reply that worked. It seems like this should be simple but I can't figure it out.

    I'm using Access 2010 and putting a graph in a report. I need to change the graph title with code.

    When I try this code I get a Run-time error 2771 "The bound or unbound object frame you tried to edit does not contain an OLE object"

    Code:
    Me.Graph1.Object.ChartTitle.Caption = "Team"
    When I try this code I get Run-time error 438 "Object doesn't support this property or method"

    Code:
    If Me!Graph1.HasTitle Then
        Me!Graph1.charttitle.Text = "Parts Supplied"
    End If
    Your help will be appreciated.

  2. #2
    Join Date
    Feb 2014
    Posts
    2

    Change graph title with VBA

    I figured out the answer to my question in this thread. To change a graph title with VBA you put the following code in PageHeaderSection_Format or PageHeaderSection_Print event. Maybe other events too but I didn't pursue it that far - just know it won't work in open event, etc.

    Code:
    Me.MyGraphName.ChartTitle.Text = "New Title"
    I'm cross posting this in several other forums because I've seen this question asked many times. Even though the replies give good code they don't tell you which event to put it in.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •