bjzielinski
IS-IT--Management
I have a list of DoCmd.OpenReport statements connected to the click event of a button. Some of the reports could have no data, so it runs the NoData section of that report, which msgbox's "No Data" and cancel=true. I have an errortrap which handles the error, however, I do not know how to set it up so that it will continue processing the rest of the reports, those may have data. It just stops all together.
Private Sub cmdGo_Click()
On Error GoTo ErrorTrap
DoCmd.OpenReport "H Changes Fire"
DoCmd.OpenReport "H Changes Clerk"
DoCmd.OpenReport "H Changes Supervisor"
DoCmd.OpenReport "H Changes Postmaster"
DoCmd.Close acForm, "H DateRange"
ErrorTrap:
If Err.Number = 2501 Then
' Do nothing, keep going
Else
MsgBox Err.Number & vbCrLf & Err.Description
End If
End Sub
Perhaps I need a command in the 'Do Nothing section to return to the next line. I tried Return but that went in an endless loop. Bill Zielinski
bzielinski@co.midland.mi.us
County of Midland, Michigan
Private Sub cmdGo_Click()
On Error GoTo ErrorTrap
DoCmd.OpenReport "H Changes Fire"
DoCmd.OpenReport "H Changes Clerk"
DoCmd.OpenReport "H Changes Supervisor"
DoCmd.OpenReport "H Changes Postmaster"
DoCmd.Close acForm, "H DateRange"
ErrorTrap:
If Err.Number = 2501 Then
' Do nothing, keep going
Else
MsgBox Err.Number & vbCrLf & Err.Description
End If
End Sub
Perhaps I need a command in the 'Do Nothing section to return to the next line. I tried Return but that went in an endless loop. Bill Zielinski
bzielinski@co.midland.mi.us
County of Midland, Michigan