Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart Object Properties

Status
Not open for further replies.

IanGalletly

Programmer
Jun 17, 2003
16
0
0
GB
I am trying to change the display of a chart on a form in Access 2000.

I have some code that changes the charttype between xlAreaStacked and xl3DBarStacked which works fine.

However, to try and tied up the display I would also like to change the text alignment. If the form starts with glbOverviewRows = "Months", the code works correctly, however if the data dictates the form starts as xl3DBarStacked then I am getting an error of "1004: Unable to get the TickLabels property of the Axis class" on the high-lighted line.


With OverviewChart

If glbOverviewRows = "Months" Then

.ChartType = xlAreaStacked

With .Axes(xlCategory, xlPrimary).TickLabels
.Orientation = xlUpward
End With

Else

.ChartType = xl3DBarStacked

With .Axes(xlCategory, xlPrimary).TickLabels
.Orientation = xlHorizontal
End With

End If

End With

I seem to need to 'requery' the chart object after the first charttype change to expose the axes collection fully.

Any suggestions please
 
I'm still not having any joy with this problem - any help would be appriciated
 
I do not know if this will help but there is certain requirements needed before you can add text. You need to specify that it has a title as in this example.

With Forms!frmGraphs.grpGraphs.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Caption = "Date"
.AxisTitle.Font.Size = 7
.TickMarkSpacing = 4
.BaseUnitIsAuto = True
.MinorUnitScale = xlDays

End With

With Forms!frmGraphs.grpGraphs.Axes(xlValue)
.HasTitle = True
.AxisTitle.Caption = "°C"
.AxisTitle.Font.Size = 7
'.MinimumScale = -70
'.MaximumScale = 0
.MinorUnit = 5
.MajorUnit = 10
.TickLabels.NumberFormat = "#,##0.0"
End With

Try and see what happens.

Hennie
 
Hi Hennie

Thanks for the reply.

You have encouraged me to have a look at this again.

I tried playing with the HasTitle property but it was still giving me the error.

However, I have just patched office to SP3 and as a result the context help pages seem to be more complete. In there I found Ticklabels use a different set of constants as the settings so I tried the following:-

.Axes(xlCategory, xlPrimary).TickLabels.Orientation = xlTickLabelOrientationHorizontal

The result was a bit odd. The error went away - but the orientation isn't changed one the first call (the error was also only happening on the first call).

So the case moves on :)

Thanks again for the response.
 
Hi Ian,

I have not done any programming using 3DbarStack but only line graphs and had a hard time to find some info on how to do certain tasks. What I did find useful was to go to Excel and create a macro of what I want to achieve and adapt the code in in Access. This gave me insight into several ways of approaching things between Excel and Access.

You may want to try it.

Hennie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top