Irrelevant posts to build post count (1 Viewer)

zooropa67

Registered User.
Local time
Today, 17:45
Joined
Mar 19, 2013
Messages
42
I'm not sure if that was aimed at me after i unsuccessfully tried to upload an example database several times but got no useful hint as to why i was unsuccessful. I've zipped the file this time. Here is what i was trying to post

I'm getting the following error:

Run-time error '1004' > Unable to set the HasTitle property of the Chart class

I've attached a small database to show the problem

There are 3 product types:
Product Type 1 > Some Yield data exists
Product Type 2 > Some Yield data exists
Product Type 3 > No Yield data exists

so if Product Type 3 is selected, the Chart Object rowsource will be empty - the chart title updates and the rest of the chart goes blank (as i'd like it to)
The problem comes if you then select Product Type 1 or 2 > It throws the above error and it's as if the error becomes hard coded into the application as shutting the database down then reopening it throws the error straight away. So I'd suggest you make a copy and call it example_safe.mdb before you run it

Any suggestions on how to update the title and make the rest of the chart go blank for any Product Type selection without throwing this error would be much appreciated
 

Attachments

  • example.zip
    53.4 KB · Views: 49

Privateer

Registered User.
Local time
Today, 12:45
Joined
Aug 16, 2011
Messages
193
The chart can have a module behind it. You could check for a title and push the results to the chart. In the OnCurrent event of the chart

Select Case ProductTypeID
Case 1
me.Chart.ChartTitle.value = "Product One"
Case 2
me.Chart.ChartTitle.value = "Product Two"
Case 3
me.Chart.ChartTitle.value = "Product Three"
case else
me.Chart.ChartTitle.value = vbnullstring
end select
I don't know the exact reference name for the chart title, but the point is you can programmatically assign the title if that helps.
 

ChrisO

Registered User.
Local time
Tomorrow, 02:45
Joined
Apr 30, 2003
Messages
3,202
You could change the Combo Box to only select a product type which has yield data.

Or you could put up a message that the product has no yield data.

Demo attached.

Chris.
 

Attachments

  • example.zip
    32.3 KB · Views: 54

zooropa67

Registered User.
Local time
Today, 17:45
Joined
Mar 19, 2013
Messages
42
Chart Title

Privateer - I think you missed the point. For Product Type 3 the Query1 returns no records and so Graph1 has no recordsource. This is what prevents you (I'm not sure why) from being able to assign a Title to Graph 1

Chris O - That works. If no records are returned from Query1 then plaster over Graph1 with a label that says "No Data Available for Product Type 3". It's a nice workaround.

I'd have thought that if Query1 returned no records then Graph would have just displayed no data but still allowed you to change other aspects of the graph such as the title. I still have a lot to learn about charts.
 

Users who are viewing this thread

Top Bottom