New adventure in VBA programming of charts on Access report. I am trying to programmatically set the color (and maybe pattern and texture) of data segments for stacked column chart. Can't get it to go beyond the first data point. Triggers error 'Unable to get the Points property of the Series class'. NOTE: Detail section Format event only runs in PrintPreview or direct to printer.
Here is the procedure:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim chtObj As Object
Dim j As Integer
Dim strType As String
Dim c1 As Long, c2 As Long, c3 As Long, c4 As Long, c5 As Long
c1 = RGB(100, 100, 100)
c2 = RGB(100, 250, 250)
c3 = RGB(100, 200, 100)
c4 = RGB(200, 200, 100)
c5 = RGB(250, 100, 100)
Set chtObj = Me.gphHole.Object
For j = 1 To 5
strType = chtObj.SeriesCollection(1).Points(j).DataLabel.Text
chtObj.SeriesCollection(1).Points(j).Interior.Color = _
Switch(strType = "OL", c1, strType = "GP-GM(S)", c2, strType = "BLDRCBBL", c3, strType = "SPG", c4, strType = "TILL", c5)
Next
End Sub
If I set the For loop as 1 To 1, the first point color will change. This code distilled from found example, which is also in the report code module of attached db.