HandsOn Writing the Page FooterSection Format Event Procedure

1. Using the Report Wizard, create a report called rptProducts based on the Products table. Choose the following fields for this report: ProductId, ProductName, UnitPrice, and UnitsInStock.

2. In the Design view of the rptProducts report, click on the Page Footer section heading and choose View | Properties. In the PageFooterSection properties sheet, click the Event tab. Click next to the OnFormat property and select [Event Procedure] from the drop-down list. Click the Build button (...) to activate the Code window.

Part IV

3. In the Code window for Report_rptProducts, enter the following PageFooterSection_Format event procedure:

Private Sub PageFooterSection_Format(Cancel As Integer, _ FormatCount As Integer) Dim ctrl As Control

For Each ctrl In Me.PageFooterSection.Controls If Me.Page = 1 Then ctrl.Visible = False

Else ctrl.Visible = True End If Next ctrl End Sub

4. Switch to the rptProducts report in Design view and click the Print Preview button. Notice that the footer does not appear on the first page of the report.

0 0

Post a comment