Handle A Report With No Data
The report "NoData" event is used if there is no data for a report. Usually, a Msgbox command is presented saying there is no data. The issue arises if the report is called from VBA. In that case, an error must be cleared as shown in the example below for error code 2501:
Program Code
Private Sub cmdPostToMAS_Click() ' ********************************************************************** ' Post New Entries To MAS ' ********************************************************************** If IsNull(Me.txtVendorNo) Or Me.txtVendorNo = "" Then If IsNull(Me.txtInvoiceNo) Or Me.txtInvoiceNo = "" Then ' ********************************************************************** ' Open The Report ' ********************************************************************** On Error Resume Next DoCmd.OpenReport "rptInvoicesToBeUploadedToMAS", acViewReport, "", "", acDialog If Err = 2501 Then Err.Clear Exit Sub Else MsgBox ("You Must Clear The Form Before Posting to MAS") Exit Sub End If Else MsgBox ("You Must Clear The Form Before Posting to MAS") End If End Sub