Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2007

Tip: Looking for answers? Try searching our database.

Message Box Instead of Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TotallyConfused - 11 Dec 2007 17:39 GMT
How can get a message box to pop up when there are no records in a report
that says, "No Records"?  On my switchboard I have a list of reports, when I
click on button report will display data and if no data it displays blank
page.  I rather a message comes up saying no records for specific report.  
Thank for any help on this question.
fredg - 11 Dec 2007 19:26 GMT
> How can get a message box to pop up when there are no records in a report
> that says, "No Records"?  On my switchboard I have a list of reports, when I
> click on button report will display data and if no data it displays blank
> page.  I rather a message comes up saying no records for specific report.  
> Thank for any help on this question.

Code the Report's OnNoData event:
MsgBox "No records to report on."
Cancel = True

Unfortunately, this will cause an error.
You need to trap the error (2501) in whatever event you used to open
the form.

Code that switchboard event:

On Error GoTo Err_Handler
DoCmd.OpenReport "ReportName", acViewPreview
Exit_This_Sub:
    Exit Sub
Err_Handler:
    If Err = 2501 Then
    Else
      MsgBox "Error #: " & Err.Number & "  " & Err.Description
    End If
    Resume Exit_This_Sub
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

TotallyConfused - 11 Dec 2007 22:30 GMT
Thank you for your response.  Once I trap this error, will this eliminate
anymore error messages?

> > How can get a message box to pop up when there are no records in a report
> > that says, "No Records"?  On my switchboard I have a list of reports, when I
[quoted text clipped - 22 lines]
>     End If
>     Resume Exit_This_Sub
fredg - 12 Dec 2007 04:56 GMT
> Thank you for your response.  Once I trap this error, will this eliminate
> anymore error messages?
[quoted text clipped - 25 lines]
>>     End If
>>     Resume Exit_This_Sub

Well, no. It will only eliminate the message regarding error 2501.
if you get a different error, then the Else portion of the code will
run and Access will give the error number and description message so
that you can take the necessary steps to correct that error.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.