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 / January 2006

Tip: Looking for answers? Try searching our database.

OnNoData System Error Msg

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sandy - 12 Jan 2006 18:53 GMT
Hello -

I put a messagebox in the Sub Report_NoData indicating no data for the
selected criteria.  It works great, except that after my messagebox comes up,
another one comes up which says "The OpenReport action was cancelled."  

I tried to turn it off by setting warnings to off before and after the
msgbox, but it still pops up.

Any suggestions on how to get rid of this?

Sandy
fredg - 12 Jan 2006 19:19 GMT
> Hello -
>
[quoted text clipped - 8 lines]
>
> Sandy

That message is not a Warnings message, it's an error message.
You need to trap that error in the code you use 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

Sandy - 12 Jan 2006 19:43 GMT
Thanks for your response, Fred!

I tried the error trapping and still got the error.  

Any other suggestions?
Signature

Sandy

> > Hello -
> >
[quoted text clipped - 22 lines]
>     End If
>     Resume Exit_Sub
fredg - 12 Jan 2006 20:38 GMT
> Thanks for your response, Fred!
>
> I tried the error trapping and still got the error.  
>
> Any other suggestions?

Precisely where did you place the code?
It goes into the form event that you use to open the report, not in
the report.
Signature

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

Ofer - 12 Jan 2006 19:27 GMT
When there is no data, how did you close the report?

In the Report_NoData just put
Cancel = True
after the msgbox
Signature

\\// Live Long and Prosper \\//
BS"D

> Hello -
>
[quoted text clipped - 8 lines]
>
> Sandy
Sandy - 12 Jan 2006 19:45 GMT
Hi Ofer -

Thanks for responding!  I already had "cancel = true" in my code.

I tried Fred's suggestion and that didn't work.  Any other thoughts?
Signature

Sandy

> When there is no data, how did you close the report?
>
[quoted text clipped - 14 lines]
> >
> > Sandy
Roger Carlson - 12 Jan 2006 19:32 GMT
If you want to see a working example, on my website
(www.rogersaccesslibrary.com), there is a small Access database sample
called "NoDataInReports.mdb" which illustrates how to do this.

Signature

--Roger Carlson
 MS Access MVP
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

> Hello -
>
[quoted text clipped - 8 lines]
>
> Sandy
rajeev - 16 Jan 2006 18:21 GMT
I also faced the same problem after puting a MsgBox  and Cancel = tru
in the  OnNoData . I solved the problem by opening the report through
macro, attaching this code  Docmd RunMacro " mOpenMyReport"

- Rajee

--
rajee
 
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.