Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

run-time error 1004 unable to set the seriescollection property"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike C - 01 Nov 2006 14:26 GMT
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
Dave - 02 Nov 2006 04:01 GMT
You just need to trap the error. If it only errors out when there's no data,
simply show a message box with words of that nature.

Try this:
On Error Goto ErrorHandler
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

ExitPoint:
Exit Sub

ErrorHandler:
Select Case err.number
    Case 1004
        Msgbox “There is no data available”
    Case else
        Msgbox err.number & “: “ err.description
End select

Resume ExitPoint

Hope that was of some help.
Dave

> 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
[quoted text clipped - 21 lines]
>          Next
>     End With
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.