Applicable Versions: All Versions


Sometimes you might want to show of hide a field on your report based on the value of an parameter.


This can be achieved by adding the parameter to the report's Page Header then adding some script to the OnFormat event of the report Detail section 


This script will hide the CustomerName field if the Country parameter is ""France"".


Sub OnFormat

  IF Rpt.Sections.item("PageHeader").Controls("Country").text = "France" then

     Rpt.Sections.item("Detail").Controls.Item("CustomerName ").visible = False

  Else

     Rpt.Sections.item("Detail").Controls.Item("CustomerName ").visible = True

  End if

End Sub