Visual Basic Concepts

Parts of the Data Report

The Data Report designer consists of the following objects:

  1. DataReport object—Similar to a Visual Basic form, the DataReport object has both a visual designer and a code module. Use the designer to create the layout of a report. You can also add code to the designer's code module to programmatically format controls or sections contained by the designer.

  2. Section object—Each section of the Data Report designer is represented by a Section object in a Sections collection. At design time, each section is represented by a header that you can click to select the section, and the section's pane where you can place and position controls. Use the object and its properties to dynamically reconfigure a report before it is built.

  3. Data Report Controls—Special controls that only work on the Data Report designer are included with it. (Note: you cannot use Visual Basic's intrinsic controls, or any ActiveX controls, on the Data Report designer). These controls are found in the Visual Basic Toolbox, but they are placed on a separate tab named "DataReport."

Sections of the Data Report Designer

The default Data Report designer contains these Sections:

  • Report Header—contains the text that appears at the very beginning of a report, such as the report title, author, or database name. If you want the Report Header to be the first page in the report, set its ForcePageBreak property to rptPageBreakAfter.

  • Page Header—contains information that goes at the top of every page, such as the report's title.

  • Group Header/Footer—contains a "repeating" section of the data report. Each group header is matched with a group footer. The header and footer pair are associated with a single Command object in the Data Environment designer.

  • Details—contains the innermost "repeating" part (the records) of the report. The details section is associated with the lowest-level Command object in a Data Environment hierarchy.

  • Page Footer—contains the information that goes at the bottom of every page, such as the page number.

  • Report Footer—contains the text that appears at the very end of the report, such as summary information, or an address or contact name. The Report Footer appears between the last Page Header and Page Footer.

Data Report Controls

When a new Data Report designer is added to a project, the following controls are automatically placed in the Toolbox tab named DataReport:

  • TextBox Control (RptTextBox)—allows you to format text, or assign a DataFormat.

  • Label Control (RptLabel)—allows you to place labels on the report to identify fields or sections.

  • Image Control (RptImage)—enables you to place graphics on your report. Note that this control cannot be bound to a data field.

  • Line Control (RptLine)—lets you draw rules on the report to further distinguish sections.

  • Shape Control (RptShape)—enables you to place rectangles, triangles, or circles (and ovals) on a report.

  • Function Control (RptFunction)—a special text box that calculates values as the report is generated.