VBScript Logic
Section-level Script settings:
OnFormat
Enter a Visual Basic script that will be executed during the formatting stage of report rendering.
OnPrint
Enter a Visual Basic script that will be executed in the final stage of rendering, after all report field values have been filled.
Report-level Script settings:
OnClose
Enter a Visual Basic script that will be executed when the report finishes rendering.
OnError
Enter a Visual Basic script that will be executed when an error occurs.
OnNoData
Enter a Visual Basic script that will be executed when the report has no data.
OnOpen
Enter a Visual Basic script that will be executed when the report starts rendering.
OnPage
Enter a Visual Basic script that will be executed each time a new page is created.
Design Philosophy for using VBScript:
Less is more! Try to use as little as possible, since it can add to the cost of maintaining the report in the future. VBScript used too much can add a lot of complexity to the report layout design.
VBScript is often necessary for achieving certain dynamic layout goals, for example changing a file’s color or visibility based on its data value.
Some reports might need to change the properties of many fields at a time based on data values, even moving their location dynamically. Instead of the brute-force approach of using conditional statements with lots of fine-grained field property setting VBScript statements, it is often preferable to instead use tow or more sub-reports, each containing one of the different layout options, and using a single VBScript statement to conditionally determine which sub-report to make visible. This is a more maintainable approach that leads to report designs that are easier to read, understand, and enhance in the future.