Sorry for the vague title, but I really have no idea what to do about this.
I have a chart in a subform, in the main form I have an option group and a drop down to select parameters for the chart and a refresh button to make these changes.
The button builds a query using the selections and then runs a make table query into the source of the chart.
The chart is a column chart, but one of the series is a line graph, as the number of series isn't consistent, the code attached to the refresh button goes through each series in turn and sets it to a column type, apart from the one that I want as a line type.
If I step through code execution, this works perfectly and I can see the chart being altered as I execute each loop of the code, but when I run the code, it doesn't update the series types and I have to run it again for it to alter the types.
I put a msgbox into the code, so I know that when running it's not picking up the correct number of series (it always picks up the number of series from the previous chart), but it's proving really hard to fix because whenever I step through the execution everything works fine.
I've tried pretty much every combination of requery/refresh/repaint I can think of on both the chart and the subform, but nothing works. I tried getting it to wait after it had run the make table query, but that didn't help. I even tried getting it to compare the number of series it was finding with the number of types in the table to automate running the code a second time if they were different, but it never updates the number of series until code execution has stopped so it just looped forever.
This is driving me even more crazy than usual, because the code works fine when stepping through, just not when running normally.
I have a chart in a subform, in the main form I have an option group and a drop down to select parameters for the chart and a refresh button to make these changes.
The button builds a query using the selections and then runs a make table query into the source of the chart.
The chart is a column chart, but one of the series is a line graph, as the number of series isn't consistent, the code attached to the refresh button goes through each series in turn and sets it to a column type, apart from the one that I want as a line type.
If I step through code execution, this works perfectly and I can see the chart being altered as I execute each loop of the code, but when I run the code, it doesn't update the series types and I have to run it again for it to alter the types.
I put a msgbox into the code, so I know that when running it's not picking up the correct number of series (it always picks up the number of series from the previous chart), but it's proving really hard to fix because whenever I step through the execution everything works fine.
I've tried pretty much every combination of requery/refresh/repaint I can think of on both the chart and the subform, but nothing works. I tried getting it to wait after it had run the make table query, but that didn't help. I even tried getting it to compare the number of series it was finding with the number of types in the table to automate running the code a second time if they were different, but it never updates the number of series until code execution has stopped so it just looped forever.
This is driving me even more crazy than usual, because the code works fine when stepping through, just not when running normally.