no data message

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to add a message when there are no records to return for a report.
This is what I have added to the reports event but I still get a blank
report with no message box...

Private Sub Report_NoData(Cancel As Integer)

On Error GoTo ErrHandler

MsgBox "Sorry. There are no records" & vbCrLf & vbCrLf & _
"to display for this report.", vbInformation + vbOKOnly, _
" No Records"
Cancel = True

Exit Sub

ErrHandler:

MsgBox "Error in Report_NoData( )" & vbCrLf & _
"in " & Me.ICNSR & " f_TrackingData " & vbCrLf & vbCrLf & _
Err.Number & vbCrLf & Err.Description

End If

End Sub
 
Dan,
Besides Marshall's response... you have and End If with no IF.
Are you showing us all the code exactly as it is?
If you still have problems, try getting rid of the Error routine and just work with the
message box.
 
Back
Top