Modern Charts - Display Data Label -> Using VBA Default On? (1 Viewer)

echorley

Registered User.
Local time
Yesterday, 23:46
Joined
Mar 11, 2003
Messages
131
Using Access 2019, and the modern charts, I have created a series of bar graphs to display aggregated student behavior counts by month. When I designed the chart, I selected "Display Data Label" so that the value shows atop each bar. The charts are based off of a table that I update with a query.

It works very well, except for the following scenario. When I change the data in the table with query, and then preview the bar graphs, the "Display Data Label" checkbox is no longer checked and the data does not show on the graph. So I have to go through and edit each chart and select this property again.

I cannot seem to find anything in the properties or using VBA to set the "Display Data Label" to true every time the graph is loaded.

Thanks in advance for any help.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 11:46
Joined
May 7, 2009
Messages
19,229
you can "force" to display the Data Labels on the Load event of your Form:
Code:
Private Sub Form_Load()
    Dim var As ChartSeries
    For Each var In Me!YourChartName.ChartSeriesCollection
        var.DisplayDataLabel = True
    Next
End Sub
 
Last edited:

echorley

Registered User.
Local time
Yesterday, 23:46
Joined
Mar 11, 2003
Messages
131
Thanks arnelgp! That worked for individual reports. Now I need to figure out how to get that code to run when each report is a sub report on a master report.

Thanks again for your help.
 

Users who are viewing this thread

Top Bottom