Search code examples
vbams-access-2010pivot-chart

VBA Access Pivot Chart set the y-axis min/max scale


Came into another snag formating my Pivot Chart via VBA in Access 2010. I get the "Run-time error '438': Object doesn't support this property or method" error.

Again, I have tried many different iterations of the code, but can't get the right one. As always, thank you in advance for your assistance.

Private Sub Form_Load()

'Call LineMarkerFormat

RONMax = DMax("[Total A/C]", "tblRONChartComparison")
RONMin = DMin("[Total A/C]", "tblRONChartComparison")

With Me.ChartSpace.Charts(0).Axes(1).Scaling
    .MinimumScale = RONMin
    .MaximumScale = RONMax

End With

End Sub

Solution

  • and the very next site I check had the very simple solution. you no longer need the scaling on the end of the .minimum/.maximum. Here is my working code.

    Private Sub Form_Load()
    
    'Call LineMarkerFormat
    
    RONMax = DMax("[Total A/C]", "tblRONChartComparison")
    RONMin = DMin("[Total A/C]", "tblRONChartComparison")
    
    
    With Me.ChartSpace.Charts(0).Axes(1).Scaling
        .Minimum = RONMin
        .Maximum = RONMax
    
    End With
    
    End Sub