Private Sub Report_NoData(Cancel As Integer) Cancel = True End Sub |
The problem with using the NoData event programmatically is that it raises an error in the calling code. Therefore, you will also need to add an error handle to the procedure that opens the Report specifically to trap this error:
Private Sub cmdPrint_Click() On Error GoTo E_Handle DoCmd.OpenReport "rptName" sExit: Exit Sub E_Handle: Select Case Err.Number Case 2501 Case Else MsgBox Err.Description, vbCritical + vbOKOnly, "Error: " & Err.Number End Select Resume sExit End Sub |
http://www.applecore99.com/rpt/rpt010.asp
No comments:
Post a Comment