VBA to Conditionally Format a Chart (2 Viewers)

I’m not completely clear what you are doing. Can you upload a cut down version of your database to look at.
 
Did you attempt the method I suggested with creating multiple columns from a single field where one of the multiple will have the value and the others will return 0?
 
I’m not completely clear what you are doing. Can you upload a cut down version of your database to look at.
Hi Colin, I've attached a sample version of the project I'm working on, along with the data.

The database will open to the calendar report and you'll see the chart in question under Monday. Above that is the controls to change the work week. Underneath these controls are some helper text boxes, which would normally be hidden. One of these boxes [Text33] is the criteria for the underlying query for the chart. It calculates in multiples of 7 as the work week changes. If you open the chart report independently and type -35 into the parameter box it will show the data in the example screenshot I previously sent.

The two issues I have with this setup since using a modern chart:
  1. The chart in the report loads quicker than the report load event so [Text33] isn't populated with 0 (as per the report load event) before the underlying query for the chart can use this as its criteria.
  2. The chart isn't responding to the requery code I previously posted.
If I can get the chart to requery, it should resolve my first issue as I can requery the chart after the report load event is complete.

Thanks for your help.
 

Attachments

Did you attempt the method I suggested with creating multiple columns from a single field where one of the multiple will have the value and the others will return 0?
I didn't because I wasn't 100% sure on what you meant and you mentioned manually changing the color of the bars and this is what I want to avoid. I was also distracted by learning about modern charts so ended up going down that route.
 
Just to check, the report shortcut is called Monday_Machine_Type_Usage_Total_StackedChartReport, the parameter dialog is

1755081507121.png


Finally the chart control is Chart4 ....

I think it will take me a while to work out how this all works and it may not be today. Perhaps others can look at it as well
 
Last edited:
Just to check, the report shortcut is called Monday_Machine_Type_Usage_Total_StackedChartReport, the parameter dialog is

Finally the chart control is Chart4 ....

I think it will take me a while to work out how this all works and it may not be today. Perhaps others can look at it as well
That's correct, Monday_Machine_Type_Usage_Total_StackedChartReport is the chart report and the chart is named Chart4.

No problem, there's no rush to resolve this. Others are welcome to take a look. I am grateful for any help I can get.
 
Two more questions to speed things up:
1. Am I right in thinking that all you are interested in is the blue progress bars on the stacked bar chart?
However, you would ideally like the progress bars to be the colour of the traffic light section where the bar ends.

2. The chart does appear to update as far as I can tell. Maybe I'm misunderstaning what you mean

For example, if I type in -35 I get the following:
1755085985833.png


but if I type in -21 I get
1755086037395.png


Similar changes occur for other parameter values
 
Two more questions to speed things up:
1. Am I right in thinking that all you are interested in is the blue progress bars on the stacked bar chart?
However, you would ideally like the progress bars to be the colour of the traffic light section where the bar ends.

2. The chart does appear to update as far as I can tell. Maybe I'm misunderstaning what you mean

For example, if I type in -35 I get the following:

but if I type in -21 I get

Similar changes occur for other parameter values
My main objective was to have the blue progress bar coloured like the traffic light system, as you say.

However, since using a modern chart, the requery part of the calendar report code is no longer working so the chart is not updating when the calendar controls are used. The chart updates with the parameter dialog but not when using the calendar report controls.

As I said previously:
The two issues I have with this setup since using a modern chart:
  1. The chart in the report loads quicker than the report load event so [Text33] isn't populated with 0 (as per the report load event) before the underlying query for the chart can use this as its criteria.
  2. The chart isn't responding to the requery code I previously posted.
If I can get the chart to requery, it should resolve my first issue as I can requery the chart after the report load event is complete.
 
Last edited:
OK thanks. Can't do anything for now as I have a problem with my Office installation which I'm trying to resolve
 

Users who are viewing this thread

Back
Top Bottom