Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when NO Data for report ???

Status
Not open for further replies.

Dylan

MIS
Aug 27, 1998
109
US
I have a report with the ON NO Data event proc set to
the following code:
===========================================
MsgBox ("No data for this report today - report cancelled ...")
Cancel = True
============================================

The msg box appears fine but after I click on OK I get an error "Run timee error 2501 - The Open Report Action was Cancelled"

The orig report code is as follows:
=============================================
DoCmd.OpenReport "rpt_BtcHdr_IFTA", acPreview
==============================================
My question is. Is there a way to avoid this break in code when ther is no data for this report ???

Thanks for any help ...


Tom Moran
Lansing, Michigan
 
try
DoCmd.SetWarnings False

your code

DoCmd.SetWarnings true

Hope this helps
Hymn
 
Tom-
Try this.

MsgBox "No records match the criteria you entered.", vbExclamation, "No Records Found"
rpt_BtcHdr_IFTA.Close
Cancel = True


Question- IFTA = International Fuel Tax Agreement?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top