Hide a field in Access if the field value is null

For example, if I am generating a report for both active and terminated employees, I don’t necessarily want to show the Termination Date field for active employees.  This code allows you to hide the [Termination Date] field and label for active employees and show it for terminated employees.


 

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)  

 Me.Name_Of_Your_Field.Visible = Not IsNull(Me.Name_Of_Your_Field)

End Sub