Y axis - variable minimum value

G

Glynn Taylor

Using Access 2000 I need to vary the Y axis minimum value depending upon the
lowest value in the charted data.

e.g. charting furnace temperatures I need to automatically set the Y axis
minimum value to 5 degrees less than the lowest charted temperature.

Is this possible?

Thanks

Glynn
 
D

Duane Hookom

Assuming your objects:
Chart control Name: GraphCtl
You have a text box in the same section as the chart with a control source
like:
=DMin("Temperature","tblTemperatures")

Add code to your section format like:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim cht As Chart
Set cht = Me.GraphCtl.Object

With cht.Axes(xlValue)
.MinimumScale = Int(Me.txtMinTemp - 5)
End With
Set cht = Nothing
End Sub

I don't know diddly about Graph coding. I first created a chart in Excel and
then turned on the macro recorder. I set the minimum Y range on the chart
and then turned the macro recorder off. Open the Excel module to find the
code you just recorded. Copy and paste the code into your On Format event of
your report section and modify a few lines.
 
G

Glynn Taylor

Thanks Duane, I'll try it.

Glynn

Duane Hookom said:
Assuming your objects:
Chart control Name: GraphCtl
You have a text box in the same section as the chart with a control source
like:
=DMin("Temperature","tblTemperatures")

Add code to your section format like:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim cht As Chart
Set cht = Me.GraphCtl.Object

With cht.Axes(xlValue)
.MinimumScale = Int(Me.txtMinTemp - 5)
End With
Set cht = Nothing
End Sub

I don't know diddly about Graph coding. I first created a chart in Excel and
then turned on the macro recorder. I set the minimum Y range on the chart
and then turned the macro recorder off. Open the Excel module to find the
code you just recorded. Copy and paste the code into your On Format event of
your report section and modify a few lines.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top