HandsOn Writing the ReportNoData Event Procedure

This hands-on uses the rptCustomers report created in Hands-On 25-1.

1. In the Visual Basic Editor Code window for the rptCustomers report, type the following Report_NoData event procedure:

Private Sub Report_NoData(Cancel As Integer)

MsgBox "There is no data for the criteria " & _

"you entered." Cancel = True End Sub

2. Open the rptCustomers report and request to see customers with a company name starting with the letter "X." Because there aren't any company names beginning with "X," a message box will be displayed, saying that there is no data for the criteria entered, and the report will be cancelled.

0 0

Post a comment