Here's a solution that worked for me. Hopefully others find this useful
My issue: Font size for data labels on histogram bars inconsistent. Data label font size for "first" bar correct (set in the properties). Data label font size for remaining bars incorrect (not the same as the first bar).
Using MS Access 2016
Solution: VBA in the Detail_Format section of the Report. The hardest part was figuring out how to get a pointer to the chart (graph) object. Turns out a chart in MS Access is a Microsoft Graph object, so you have to include the
Microsoft Graph nn.n Object Library in Tools->References. The MS doc'n for this is poor. Anyway, once you figure out how to get the pointer to the object, it's fairly straight-forward from there.
In the sub below,
NameOfTheChartInYourReport is whatever name you gave the chart in your report
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' There are some oddities when using multi-bar graphs, most notably inconsistent Font sizes
' The code here overcomes this issue
' Note: the Microsoft Graph library must be included in the Tools->References
Dim objChart As Graph.Chart
Dim objChartSeries As Graph.Series
Dim objSeriesDataLabel As Graph.DataLabel
Set objChart =
NameOfTheChartInYourReport.Object ' Get a pointer to the chart object in the report
' Loop through all of the Series in the Chart
For Each objChartSeries In objChart.SeriesCollection
' Loop through all of the DataLabels in the Series
For Each objSeriesDataLabel In objChartSeries.DataLabels
objSeriesDataLabel.Font.Size = 8
Next objSeriesDataLabel
Next objChartSeries
' Change the Legend font color to Blue
With objChart
.Legend.Font.Color = vbBlue
End With
End Sub