Access chart .hastitle problem

I'm getting error on the following
dim ochart as object
set ochart = frm.fieldnameforchart
ochart.charttype = xlColumnClustered
ochart.hastitle   = True

it fails on the .hastitle line with
error 1004 - unable to set the HasTitle property of the Chart Class

I also get failure on
ochart.axes(xlValue).ticklables.numberformat = "0%"

any thoughts - ?  

thanks in advance.
(please don't tell me to do this in excel, I'm stuck with doing all of this charting directly in Access Forms.  - thanks)
LVL 4
Keyboard CowboyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nick67Commented:
I'm poking the bear.
When I declare the Chart on the report I use this syntax

With Me.grphLoadTest.Object
    .Axes.Item(xlValue).MaximumScale = ChartMaxVal
    .Axes.Item(xlCategory).MaximumScale = ChartMaxCategory
    .HasTitle = True
    .ChartTitle.Text = "frig"
    .Axes.Item(xlValue).TickLabels.NumberFormat = "0.00"
    .Axes.Item(xlValue).TickLabels.Font.ColorIndex = 3
End With

This gives me a red Y axis with two decimal places and a title
0
Keyboard CowboyAuthor Commented:
This is on a form - unsure if that makes a difference.
I know you have to declare .rowsource before doing much else.
but I still get failure on simple .hastitle = true
and you can't set the charttitle.text until .hastitle is true.

however, when I let it run through (on error resume next) - it shows the chart with the last title which was successful.
(as it doesn't fail EVERY time).

guess I just need to move things around or repeat a command perhaps to get it to 'take' - I've seen this before in charting on Access.... thanks for the trial run you provided however.
0
Nick67Commented:
guess I just need to move things around or repeat a command perhaps to get it to 'take'
I noted that, too
I commented out the four lines

    .HasTitle = True
     .ChartTitle.Text = "frig"
     .Axes.Item(xlValue).TickLabels.NumberFormat = "0.00"
     .Axes.Item(xlValue).TickLabels.Font.ColorIndex = 3


Bedamned if the changes didn't persist!
I certainly didn't expect changes pushed through VBA to persist as permanent changes to the Chart object, but it seems they do.
I don't think that it matters if the Chart is on a form or report.
And what broken Help Access 2003 provides does show syntax like yours -- but my object is instantiated with different syntax and I do get full Intellisense support doing it this way.

My initial thought is that you object declaration isn't getting the right thing going properly.
With mine, I don't use VBA to screw with the .RowSource.
Instead, they are pointed at 'temp' tables where I can flange in volatile data from other locations.
They're brittle, odd, things as you well know.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Keyboard CowboyAuthor Commented:
Yeah, on forms - you can set various chart parameters using the user interface and chart wizard, ...  - then just set the changing ones via VBA and it remembers the old chart parameters.

that's why it keeps the old title - because it fails on .hastitle = true and also .charttitle.text = "whatever"

I'm new and don't know about intellisense unless you mean the auto-fill  (I type .charttitle and it gives me .text as an option)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.