This sample shows you how to pass a SQL string into a report at run time. It consists of a CategoryProducts report and a CategorySelectForm.
The ActiveReports Viewer control fills most of the form, and a combo box at the top allows the user to select which data to send to the viewer.
Right-click the form and select View Code to see how this is done.
This report lists products in the selected category, and summarizes the number of products. Here are the features used in each section:
This section cannot be deleted, because the related ReportFooter section is used. When this is the case, the best practice is to set the unused section's Height property to 0.
This section contains two bound TextBox controls to display each product in the selected category along with its price.
Although the form passes data to the report at run time, the report's data source is set for design time use. It is easier at design time to drag bound fields onto the report from the Report Explorer than it is to create them and set their properties. The data source also allows you to preview the report while you are designing it.
Click the DataSource Icon on the Detail band to view the data source.
This section uses the ReportInfo control to display Page N of M. In the Properties window, you can select a way to display the page number and run date in the FormatString property.
This section contains a Label control and a bound TextBox. The TextBox uses the SummaryType of GrandTotal to display the total number of products in the selected category.