Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74

    Unanswered: Error:Change y-axis of scale of "Microsoft graph 2000" graph

    Error:Change y-axis of scale of "Microsoft graph 2000" graph

    A graph object can be accessed (to change the scales) this way in an Excel application.
    With ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlValue)
    .MaximumScale = 15
    .MinimumScale = 5
    End With

    What is the equivalent in an Access 2000 application? I am trying to change the max and min on the y-axis (of a linear graph OLE Class: Microsoft graph 2000 chart and class: MSGraph.Chart.8) based on the data I am plotting. Each of the code (tries) below gives me an error such as “object doesn’t support this property of method”

    With Me.[ContractLinearGraph].Axes(1) ' this blows up
    'With Me.[ContractLinearGraph].axes(xlvalue) ' this blows up
    'With Me.[ContractLinearGraph].Chart.Axes(xlValue) ' this blows up
    'With Me.Application.ChartObjects("ContractLinearGraph") .Chart.Axes(xlValue) ' this blows up

    If bPlottable Then
    .MinimumScaleIsAuto = False
    .MaximumScaleIsAuto = False
    .MinimumScale = CDbl(yaxisMinimum)
    .MaximumScale = CDbl(yaxisMaxmum)
    End If
    End With

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    Access is a bit different than Excel here, it does not directly implement Graph in it's framework. The Graph control is just the container for it's OLE server. To access any properties of it you need to reference the Object property, thus:

    With Me.[ContractLinearGraph].Object.Axes(1)

  3. #3
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    Thanks for your response. I tried your approach

    With Me.[ContractLinearGraph].Object.Axes(2)


    and ended up gettitng the following message:

    Error Number 2771 – The bound and unbound object frame you tried to edit doesn’t contain an OLE object.

    I saw this on some website


    'Reports(strRpt)!OLEUnbound0.Object.Application.ch art.axes(2).minimumscal = 0
    'Reports(strRpt)!OLEUnbound0.Object.Application.ch art.axes(2).maximumscale = 10
    'Reports(strRpt)!OLEUnbound0.Object.Application.ch art.axes

    I tried it and got the same error.


    your continued help will be appreciated.

  4. #4
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    That's odd.

    Does the chart have a record source at the time you are trying to do this? Can you "edit" it, i.e. open up graph and change the layout settings? What values do the OLEClass and Class properties have?

  5. #5
    Join Date
    Feb 2002
    Location
    Silver Spring, Maryland
    Posts
    74
    Believe it or not, when I put my linear graph in the header section of a report, this:

    With Me![ContractLinearGraph].Axes(2)

    If bPlottable Then
    .MinimumScaleIsAuto = False
    .MaximumScaleIsAuto = False
    .MinimumScale = CDbl(yaxisMinimum)
    .maximumscale = CDbl(yaxisMaxmum)
    End If

    End With

    works like a charm. Why? I guess we should ask Bill Gates.

    Thanks for your input.

    Wango

  6. #6
    Join Date
    Jul 2003
    Posts
    2
    Here's a bit more info on this problem:

    I ran into the same error message when attempting to reference a chart object in code. I moved the code from the Report_Open event to Report_Activate and it worked. I'll leave it to those of you with more experience in these matters to figure out why this works. I'm just glad it did!

Posting Permissions

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