• Changing Graph Properties

    Author
    Topic
    #355579

    I have a graph embedded on a form which was created with the Wizard.
    I have a number of controls on the form to allow the user to define the RowSource for the Graph.
    I have a button on the form that runs code to set the Graph’s Rowsource to what the User defined.
    So far, all is well…
    When this code fires off, I am trying to programmatically modify the Graph’s Title as well.

    The Problem occurs only the first time I try to pull this off. I am told that Access is, “Unable to Set the HasTitle Property of the Chart Class.”

    If I hit the ‘End’ button, the Rowsource stuff works, but the Title stuff fails. Hitting the command button a second time invariably works fine! And so do any subsequent changes to the RowSource. Every time I make a change, everything works fine after it fails once.

    Anyone got any ideas?

    Thanks,

    Rich Powers

    Viewing 0 reply threads
    Author
    Replies
    • #524733

      My preference is to leave the title of the actual chart blank. Then I use a label/text box above where the chart is embedded for the title. This gives me easier coding access for titling.

      • #525083

        Thanks for the post. But I need to have the approprate title within the graph because the users want to be able to copy it from the Access form and paste it into other applications as they see fit.

        I have come up with a workaround, but it still doesn’t tell me why I need one. What I have done is modified the code so that when the user hits the ‘Apply’ button, the code checks to see if this is the first time the graph is being updated. If it is, then the update code runs twice with the ‘On Error Resume Next’ statement in between each pass.

        If it is not the forst pass at the graph, it worked fine anyway! It appears that the graph must initialize, or get drawn, or something, before I can modify some properties.

        Still looking for the answer…

        Thanks,

        Rich P.

        • #547125

          Hmmm,
          Better late than never, I hope.
          I used something like what’s below….

          Me!chartPerf.hastitle = True
          Me!chartPerf.charttitle.Text = “This is a title”

          where chartPerf is the name of the chart.

          HTH
          cheers

          • #547140

            I was able to figure it out eventually. And I came up with exactly the same answer. It was so long ago, I can’t even remember how I came across it, but I no longer need to count how many times the Graph has been updated. It works fine.

            Funny how little info there is out there in the world about controlling graphs programatically!

            Thanks again,

            Rich P.

    Viewing 0 reply threads
    Reply To: Changing Graph Properties

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: