By default, when you have a section report open in the ActiveReports Designer, you can see nodes like the following.
- The Report
- Each report section, for example:
- Detail (default, cannot be removed)
- Report Header and Footer (default, can be removed)
- Page Header and Footer (can be added)
- Group Header and Footer (can be added)
- Each control, for example:
- TextBox
- Picture
- PageBreak
- SubReport
- Fields
- Bound (lists fields from the bound data source)
- Calculated (right-click to add calculated fields)
- Parameters (right-click to add parameters)
- Report Settings (opens a dialog for page setup, printer settings, styles and global settings)
In the Report Explorer, in addition to removing controls, adding, editing or removing parameters, adding a data source, and dragging fields onto the report, you can also add, edit, or remove calculated fields; drag bound data fields onto the report as textbox controls; change report settings like margins, printer settings, styles, and ruler and grid settings. You can also select the report or any element in the report to display in the Properties window, where you can modify its properties.
- Click the gray report DataSource icon on the Detail section band to open the Report Data Source dialog.
- On the OLE DB tab, next to Connection String, click the Build button.
- In the Data Link Properties window that appears, select Microsoft Jet 4.0 OLE DB Provider and click the Next button. Click the ellipsis (...) button to browse to your database or the sample Northwind database, nwind.mdb.
- Once you have selected your *.mdb file, click Open.
- Click OK to close the window and fill in the Connection String field.
- In the Query field, enter a SQL query to select the data that you want, for example SELECT * FROM Customers.
- Click OK to save the data source and return to the report design surface. In the Report Explorer, under the Fields node, the Bound node is populated with fields returned by the query.
- In the Report Explorer, expand the Fields node.
- Right-click the Calculated node and select Add. The new calculated field is displayed in the Report Explorer and in the Properties window.
- In the Properties window, set the Formula property to a calculation, for example: = UnitPrice * 1.07
- Drag the field from the Report Explorer onto the design surface of your report to create a textbox that is bound to the field.
To bind a Field to a TextBox control
- In the Report Explorer, expand the Fields node, then the Bound or Calculated node that you want to use.
- Click the field that you want to bind to a TextBox control, drag it onto the report surface and drop it into the section where you want the TextBox to appear.
- A TextBox control is created and bound to the field with the filed name in the DataField property, and a related value in the Name and Text properties. For example, if you drag the City field onto the report, the DataField property of the TextBox becomes City, the Name and Text properties become txtCity1.
- In the Report Explorer, right-click the Parameters node and select Add. The new parameter is displayed in the Report Explorer and in the Properties window.
- In the Properties window, set the Prompt property to a string value to ask users for data.
- Leave the PromptUser property set to True. When you run the report, a dialog displays the Prompt to the user.
- From the Report Explorer, drag the parameter to the report design area to create a TextBox that is bound to the parameter. When you run the report, the value that the user supplies in the prompt dialog displays in the bound TextBox on the report.
- In the Report Explorer, double-click the Settings node. The Report Settings dialog appears.
- You can set a number of options on the four tabs in the dialog.
- When you have finished changing report settings, click OK.