Visual Basic Concepts

Adding Date, Time, Page Number, and Title to the Data Report

You can add Header and Footer data to each page of a data report by adding an appropriate Label control to the Page Header or Page Footer section. The Data Report designer features the following header and footer sections:

  • Report Header—Occurs only once, at the very top of the report. Can be used for introductory material, such as the purpose of the report.

  • Report Footer—Like the Report Header, occurs only once, at the very end of the report. Can be used for summary material, such as conclusions, or highlights of the report, or grand totals using the Function control.

  • Page Header—Occurs at the top of every page. Can be used for page number, date and time of the report, or title of the report.

  • Page Footer—Occurs at the bottom of every page. Can also be used for page number, date and time of the report, or other incidental information.

The Data Report designer contains several pre-configured controls that can be used to quickly add the date, time, page number, or report title to any section of the report. These controls are simply Label controls containing codes that display the following information:

Function Code
Current Page Number %p
Total Number of Pages %P
Current Date (Short Format) %d
Current Date (Long Format) %D
Current Time (Short Format) %t
Current Time (Long Format) %T
Report Title %i

Note   To display a percent sign, use %%.

To add the title and page numbers to the page header

  1. Click the Data Report designer's title bar to select it.

  2. On the Properties window, click Title and type Orders By Date Under Customer Grouped by Country. This is the title that will display in the page header.

  3. Right-click the Data Report designer and click Show Page Header/Footer.

  4. Right-click the page header section and click Insert Control.

  5. From the menu, click Report Title.

  6. Reposition the new control in the middle of the section, extending it wide enough to display the entire report title.

  7. Repeat step 4.

  8. From the menu, click Current Page Number.

  9. Position the new control in the far right corner of the designer.

  10. Set the new control's Alignment property to 1 – Justify Right.

Step by Step

This topic is the last in a series that walks you through creating a sample data report.

To See
Start from the beginning Creating a Simple Data Report