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 / March 2008

Tip: Looking for answers? Try searching our database.

No Data To Print

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
luis_a_roman - 28 Mar 2008 14:55 GMT
I have a report that If there is not data to print, I would like to display a
message indicating that there are no record to print. I'm able to use the
nodata event to display the message but I still open the blank report in
preview mode. I included a Docmd command to quit the report but it does not
work.

My question is; is there anyway that I can display the message and avoid the
blank preview reprot from showing?

Your guidance and knowledge share will be appreciated.

Luis
John Spencer - 28 Mar 2008 15:08 GMT
Normally, all you need to do is set Cancel = True in the On No Data event.

If you are calling the report from somve VBA code you will have to trap the
error that is generated.

Signature

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
.

>I have a report that If there is not data to print, I would like to display
>a
[quoted text clipped - 11 lines]
>
> Luis
fredg - 28 Mar 2008 16:16 GMT
> I have a report that If there is not data to print, I would like to display a
> message indicating that there are no record to print. I'm able to use the
[quoted text clipped - 8 lines]
>
> Luis

In the Report's NoDataEvent, write:

MsgBox "There are no records."
Cancel = True

If you have used code to open the report, this will raise Error 2501
"You have canceled ....etc."
Trap this error in the code event you have used to open the report.

On Error GoTo Err_Handler
DoCmd.OpenReport "ReportName", acViewPreview

Exit_Sub:
    Exit Sub
Err_Handler:
    If Err = 2501 Then
    Else
        MsgBox "Error #: " & Err.Number & " " & Err.Description
    End If
    Resume Exit_Sub
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.