Regarding Reports

cnuhima

Registered User.
Local time
Today, 14:27
Joined
Jun 19, 2008
Messages
72
Hi,

I have a small doubt..when i am doing reports..The report shows the results only when the given criteria is satisfied..But when No data is found with that criteria..I want to display a message saying..no records found..

How can I do that..

Thank you very much..

With Regards,
HimaBindu.B
 
Here's an example of the NoData event for a report, straight from Access Help:

Code:
Private Sub Report_NoData(Cancel As Integer)
    MsgBox "The report has no data." & _
         chr(13) & "Printing is canceled. " & _
         chr(13) & "Check the data source for the " & _
         chr(13) & "report. Make sure you entered " & _
         chr(13) & "the correct criteria (for " & _
         chr(13) & "example, a valid range of " & _
         chr(13) & "dates),." vbOKOnly + vbInformation
    Cancel = True
End Sub
 
Here's an example of the NoData event for a report, straight from Access Help:

Code:
Private Sub Report_NoData(Cancel As Integer)
    MsgBox "The report has no data." & _
         chr(13) & "Printing is canceled. " & _
         chr(13) & "Check the data source for the " & _
         chr(13) & "report. Make sure you entered " & _
         chr(13) & "the correct criteria (for " & _
         chr(13) & "example, a valid range of " & _
         chr(13) & "dates),." vbOKOnly + vbInformation
    Cancel = True
End Sub

Although, just a reminder that you will need to handle the ERROR 2501 which will be generated on the event that initially opened the report.
 

Users who are viewing this thread

Back
Top Bottom