Dynamic axis scale

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

As suggested by 'SA' of 'ACG Soft' in another post under 'Flexible default
y-axis labels in Microsoft Graph', I tried the following code to try to
programmatically control the X-Axis scale of a chart in an MS Access 2003
report. I get an 'Object doesn't support this property or method' error on
the 'Set objAxis = ...' line. I also tried using the ADO 2.8 Library instead
of the already selected ADO 2.5 Library reference.

Any suggestions? Thanks in advance!

**** Suggested Code ****
Dim objGraph as Object
Dim objAxis as Object
Set objGraph = Me!NameOfYourGraphObject
Set objAxis = objGraph.Axis(2) 'Y Axis
With objAxis
.MinimumScale = YourMinimumValue
.MaximumScale = YourMaximumValue
.MajorUnitScale = SomeVale
End With
 
The ADO libraries would have no effect on the chart code. Could you please
provide your exact code?
 
Thanks for the reply Duane. The exact code is provided below. It breaks at
'Set objAxis = objGraph.Axis(1)'. I also tried adding the MS Graph 11.0
Object Library, with no success. Other info: the OLE Class for the object
is 'Microsoft Graph Chart' and the Class of the object is MSGraph.Chart.8 -
it's a simple bar graph.
Thanks in advance!

Dim objGraph as Object
Dim objAxis as Object
Set objGraph = Me!Graph_Volume_Analysis 'Bar graph object
Set objAxis = objGraph.Axis(1) 'Y Axis
With objAxis
.MinimumScale = dtmMinDate
.MaximumScale = dtmMaxDate
End With
 
Try something like this substituting an e for an i in objGrpah.Axes(2).
Also add .Object.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim objGraph As Object
Dim objAxis As Object
Set objGraph = Me.Graph_Volume_Analysis.Object
Set objAxis = objGraph.Axes(2) 'Y Axis
With objAxis
.MinimumScale = dtmMinDate
.MaximumScale = dtmMaxDate
End With
End Sub
 
Back
Top