Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 4th, 2005, 10:48 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default Error Handling on Report_NoData

Hi,

   Okay, here is the code I am using for reports when there is no data:

'==========Code Starts============
Private Sub Report_NoData(Cancel as Integer)
   Cancel = MsgBox("No Records Found", vbInformation, Me.Caption)
End Sub
'==========Code Ends==============

This works fine. When there is no data for the report, a messagebox comes up with the title of the report, and the message that No Records Found.

However, once you click Ok, a second message box comes up stating that the action has been cancelled.

How do I get rid of this second message box?

Thanks,

mmcdonal
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com
 
Old January 5th, 2005, 05:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Hmmm... how about

Private Sub Report_NoData(Cancel as Integer)

   DoCmd.SetWarnings False
   Cancel = MsgBox("No Records Found", vbInformation, Me.Caption)
   DoCmd.SetWarnings True

End Sub


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
error handling Abhinav_jain_mca General .NET 5 December 21st, 2005 01:12 AM
Error Handling twbit BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 3rd, 2005 09:18 PM
Error handling Hudson40 Access VBA 2 February 11th, 2005 05:32 AM
Error Handling zaeem Classic ASP Basics 2 November 14th, 2003 10:42 AM
Error handling ! ittorget Classic ASP Professional 2 November 14th, 2003 09:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.