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
- Click the Data Report designer's title bar to select it.
- 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.
- Right-click the Data Report designer and click Show Page Header/Footer.
- Right-click the page header section and click Insert Control.
- From the menu, click Report Title.
- Reposition the new control in the middle of the section, extending it wide enough to display the entire report title.
- Repeat step 4.
- From the menu, click Current Page Number.
- Position the new control in the far right corner of the designer.
- 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.