M
Mike C
I'm using vb to format a pie chart in my access report. it works fine when
there's data but i get the error "run-time error 1004 unable to set the
seriescollection property" when there's none. Does anyone know how I can
modify my code to handle this? The code is below. Thanks!!
Dim myChart As Graph.Chart
Set myChart = Me.myChart.Object
myChart.Refresh
myChart.Application.Update
With myChart.SeriesCollection(1)
For i = 1 To .Points.Count
Select Case myChart.Application.DataSheet.Cells(i + 1, 1).Value
Case "AAA"
.Points(i).Interior.ColorIndex = 3 ' Red
Case "BBB"
.Points(i).Interior.ColorIndex = 6 ' Yellow
Case "CCC"
.Points(i).Interior.ColorIndex = 4 ' Green
Case Else
.Points(i).Interior.ColorIndex = 5 ' Blue
End Select
Next
End With
there's data but i get the error "run-time error 1004 unable to set the
seriescollection property" when there's none. Does anyone know how I can
modify my code to handle this? The code is below. Thanks!!
Dim myChart As Graph.Chart
Set myChart = Me.myChart.Object
myChart.Refresh
myChart.Application.Update
With myChart.SeriesCollection(1)
For i = 1 To .Points.Count
Select Case myChart.Application.DataSheet.Cells(i + 1, 1).Value
Case "AAA"
.Points(i).Interior.ColorIndex = 3 ' Red
Case "BBB"
.Points(i).Interior.ColorIndex = 6 ' Yellow
Case "CCC"
.Points(i).Interior.ColorIndex = 4 ' Green
Case Else
.Points(i).Interior.ColorIndex = 5 ' Blue
End Select
Next
End With