no data message

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
 
M

Marshall Barton

Double check that the report's OnNoData property is set to
[Event Procedure]
 
A

Al Camp

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top