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 / Modules / DAO / VBA / July 2007

Tip: Looking for answers? Try searching our database.

Error Handling using No Data (on report) - need to repress OpenReport msg

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DaveSwain - 12 Jul 2007 14:11 GMT
Hello,

I have an access form that does an openReport based on selectio
criteria; see code below:

Private Sub Report_NoData(Cancel As Integer)
   MsgBox "No Data was found for your criteria, The Report will not
run unless Data is found"
   Cancel = True
End Sub

... however after my error message(MsgBox) is displayed, Another error
message pops up and says "The OpenReport Action was Canceled"

I do NOT want to display that second message, only my first 'MsgBox'
error message.

Is there anyway that I can repress the second pop-up error message(and
still have the report cancel from opening with no data?

This code is in the report btw.

The code that calls it in the form is here:

...
DoCmd.OpenReport stDocName, acPreview, , "StoreID = " & cmbFilter
...

How can I repress that second message??

thank you,
David
MarkS - 12 Jul 2007 14:22 GMT
Dave,

Try entering the following line of code in your module which should suppress
the warning.

DoCmd.SetWarnings False

HTH
Mark

> Hello,
>
[quoted text clipped - 28 lines]
> thank you,
> David
SteveM - 12 Jul 2007 14:42 GMT
If you are going to use 'DoCmd.SetWarnings False' then put it before your
line of code that opens the Report. You must make sure that you set warnings
back to True either immediately after opening the Report or before the end of
your procedure. To do this use:

DoCmd.SetWarnings True

Steve

> Dave,
>
[quoted text clipped - 38 lines]
> > thank you,
> > David
 
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.