Chart Refreshing problem.
Hi, I am making this program in VBA where i have an X-Y chart whose data is determined by a query. Now I have to refresh the chart to show new values selected if i press some button on that form where chart is located. So i clear the chart so that no previous point on chart remains. but it gives an error "Cannot find seriescollection property of the chart class"
but when i press F8 and F5 again, then it compiles. Can someone help me with this please.
Dim cha as Chart
Dim sr as series
qry = "select price, volumes from price_table"
MainForm.ChartXY.RowSource = qry
set cha = MainForm.ChartXY.Object
cha.clear
MainForm.ChartXY.RowSource = qry
set cha = MainForm.ChartXY.Object
Set sr = cha.seriesCollection(1) <--- stops here with the error message. But i press an F8 from here after the error. it runs. please help me.
////////////////////
then further code....
|