Access VBA – conditional change decimal place for report fields

The “Terms to Graduation” data is given 2 decimal places to help identify the small differences from year to year, while the data of the rest of the report are in integers.

VBA coding:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me![Table Name].Value = “F. Terms to Graduation (Calendar Year)” Then
Me.[2008].DecimalPlaces = “2”
Me.[2009].DecimalPlaces = “2”
Me.[2010].DecimalPlaces = “2”
Me.[2011].DecimalPlaces = “2”
Me.[2012].DecimalPlaces = “2”
Me.[2013].DecimalPlaces = “2”
Me.[2014].DecimalPlaces = “2”
Else
Me.[2008].DecimalPlaces = “0”
Me.[2009].DecimalPlaces = “0”
Me.[2010].DecimalPlaces = “0”
Me.[2011].DecimalPlaces = “0”
Me.[2012].DecimalPlaces = “0”
Me.[2013].DecimalPlaces = “0”
Me.[2014].DecimalPlaces = “0”
End If
End Sub

Report results:

access2-1

Y. I. An