Unable to set text property of the Charttitle class

L

Laurel

I have the following code in my Load event. I developed it from some code I
found in grphsm97.mdb on the Microsoft download site. See bottom of this
posting for that code. Unfortunately, when the assignment line executes, I
get this error. I'm running Access 2003, and converted the Access 97
database.

"Unable to set text property of the ChartTitle class"

Is there any way I can change the chart title dynamcially.

My code in the load event.

Me!Graph23.SetFocus
Me!Graph23.Charttitle.Text = "new chart title"

The code I found in grphsm97.mdb.
'--------------------------------------------------
' Show or Hide the Title using the Not Operator to
' reverse the state ofthe Hastitle property
'--------------------------------------------------

Me!Graph1.HasTitle = Not Me!Graph1.HasTitle

' If the graph has a title, set the Caption to somthing
If Me!Graph1.HasTitle Then
Me!Graph1.charttitle.Text = "Sample Title"
End If
 
R

ruralguy via AccessMonster.com

Try:
Me!Graph23.Charttitle.SetFocus
Me!Graph23.Charttitle.Text = "new chart title"

The control needs to have the focus in order to alter the .Text property.
 
L

Laurel

This causes the error, "Object does not support this property or method."
It works OK in the converted grphsm97.mdb, so it can't be my general Access
environment. I notice that in both mdb's "charttitle" does not show up in
the list of attributes when you type the period after Me!Graph23 (or
Me!Graph1). But I'm able to change the title in the sample database. It
must be some attribute of the chart itself????
 
R

ruralguy via AccessMonster.com

Sorry Laurel but that was my best guess. I'm unable to locate the grphsm97.
mdb so I could play with it myself and maybe help.
This causes the error, "Object does not support this property or method."
It works OK in the converted grphsm97.mdb, so it can't be my general Access
environment. I notice that in both mdb's "charttitle" does not show up in
the list of attributes when you type the period after Me!Graph23 (or
Me!Graph1). But I'm able to change the title in the sample database. It
must be some attribute of the chart itself????
Try:
Me!Graph23.Charttitle.SetFocus
[quoted text clipped - 31 lines]
 
L

Laurel

I also tried putting it in the click event of a button, and clicked the
button only after the chart was displaying data. But that didn't help
either.
 
L

Laurel

http://support.microsoft.com/search/
Put Access in the "product" and "grphsm97.mdb" in the "for."


ruralguy via AccessMonster.com said:
Sorry Laurel but that was my best guess. I'm unable to locate the
grphsm97.
mdb so I could play with it myself and maybe help.
This causes the error, "Object does not support this property or method."
It works OK in the converted grphsm97.mdb, so it can't be my general
Access
environment. I notice that in both mdb's "charttitle" does not show up in
the list of attributes when you type the period after Me!Graph23 (or
Me!Graph1). But I'm able to change the title in the sample database. It
must be some attribute of the chart itself????
Try:
Me!Graph23.Charttitle.SetFocus
[quoted text clipped - 31 lines]
Me!Graph1.charttitle.Text = "Sample Title"
End If
 
R

ruralguy via AccessMonster.com

Thanks for the link. I was looking in the wrong place.

I think I would try changing your code to:

If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If

...and see what happens.

http://support.microsoft.com/search/
Put Access in the "product" and "grphsm97.mdb" in the "for."
Sorry Laurel but that was my best guess. I'm unable to locate the
grphsm97.
[quoted text clipped - 13 lines]
 
L

Laurel

Hah!!!! That did it!!! I don't see the logic of why this should work and
nothing else, but it does. Thanks!!!

ruralguy via AccessMonster.com said:
Thanks for the link. I was looking in the wrong place.

I think I would try changing your code to:

If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If

..and see what happens.

http://support.microsoft.com/search/
Put Access in the "product" and "grphsm97.mdb" in the "for."
Sorry Laurel but that was my best guess. I'm unable to locate the
grphsm97.
[quoted text clipped - 13 lines]
Me!Graph1.charttitle.Text = "Sample Title"
End If
 
L

Laurel

Argghhh!!!!! I watched your suggestion work. But it never worked again.
Even though the charttitle is clearly displayed, I've never again seen
HasTitle = True so that the setting statement is executed......

I have no idea what's happening.

I do see enough stuff in a Google search of charttitle to be reassured that
it's in general flakey!

ruralguy via AccessMonster.com said:
Thanks for the link. I was looking in the wrong place.

I think I would try changing your code to:

If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If

..and see what happens.

http://support.microsoft.com/search/
Put Access in the "product" and "grphsm97.mdb" in the "for."
Sorry Laurel but that was my best guess. I'm unable to locate the
grphsm97.
[quoted text clipped - 13 lines]
Me!Graph1.charttitle.Text = "Sample Title"
End If
 
R

ruralguy via AccessMonster.com

Try starting off with:
Me!Graph23.HasTitle = True
If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If

Argghhh!!!!! I watched your suggestion work. But it never worked again.
Even though the charttitle is clearly displayed, I've never again seen
HasTitle = True so that the setting statement is executed......

I have no idea what's happening.

I do see enough stuff in a Google search of charttitle to be reassured that
it's in general flakey!
Thanks for the link. I was looking in the wrong place.
[quoted text clipped - 14 lines]
 
R

ruralguy via AccessMonster.com

Maybe even:

Me!Graph23.HasTitle = True
Me!Graph23.charttitle.Text = "new chart title"
Try starting off with:
Me!Graph23.HasTitle = True
If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If
Argghhh!!!!! I watched your suggestion work. But it never worked again.
Even though the charttitle is clearly displayed, I've never again seen
[quoted text clipped - 10 lines]
 
L

Laurel

Well, I did get it to happen again, but not consistently. I had the code
suggested below in the form's Load event, in the event that actually loaded
the data in the chart (at the end), in a function called at the end of that
event, and in a button. I had different text in each script, so I could be
sure which executed. Everyone executed at least once except the code at the
end of the event loading the graph. I could never figure out a pattern. So
I removed the title and put it on the form.....

Thanks for your help. You enabled me to decide that it's just too flakey to
deal with.

ruralguy via AccessMonster.com said:
Thanks for the link. I was looking in the wrong place.

I think I would try changing your code to:

If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If

..and see what happens.

http://support.microsoft.com/search/
Put Access in the "product" and "grphsm97.mdb" in the "for."
Sorry Laurel but that was my best guess. I'm unable to locate the
grphsm97.
[quoted text clipped - 13 lines]
Me!Graph1.charttitle.Text = "Sample Title"
End If
 
R

ruralguy via AccessMonster.com

That sounds good to me. Have fun.
Well, I did get it to happen again, but not consistently. I had the code
suggested below in the form's Load event, in the event that actually loaded
the data in the chart (at the end), in a function called at the end of that
event, and in a button. I had different text in each script, so I could be
sure which executed. Everyone executed at least once except the code at the
end of the event loading the graph. I could never figure out a pattern. So
I removed the title and put it on the form.....

Thanks for your help. You enabled me to decide that it's just too flakey to
deal with.
Thanks for the link. I was looking in the wrong place.
[quoted text clipped - 14 lines]
 
L

Laurel

I had tried that, but I was told that ... well I forget the exact error, but
I was told I couldn't set HasTitle to true.

ruralguy via AccessMonster.com said:
Try starting off with:
Me!Graph23.HasTitle = True
If Me!Graph23.HasTitle Then
Me!Graph23.charttitle.Text = "new chart title"
End If

Argghhh!!!!! I watched your suggestion work. But it never worked again.
Even though the charttitle is clearly displayed, I've never again seen
HasTitle = True so that the setting statement is executed......

I have no idea what's happening.

I do see enough stuff in a Google search of charttitle to be reassured
that
it's in general flakey!
Thanks for the link. I was looking in the wrong place.
[quoted text clipped - 14 lines]
Me!Graph1.charttitle.Text = "Sample Title"
End If

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

I just put a button on the sample db with basically:

Me!Graph23.HasTitle = True
Me!Graph23.charttitle.Text = "new chart title"

...in the click event and it works *every* time without an error.
I had tried that, but I was told that ... well I forget the exact error, but
I was told I couldn't set HasTitle to true.
Try starting off with:
Me!Graph23.HasTitle = True
[quoted text clipped - 17 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