Susan Geller
sgeller at cce.umn.edu
Thu Aug 14 11:16:40 CDT 2003
Charlotte, Here's the code that I have (abbreviated) in the event that opens the report. When I step through, the Err.Number is in fact 2501, but the code goes to the Else part of my If logic. Ideas? Private Sub cmdNext3_Click() On Error GoTo eh strReport = Me.lstGroupOptions.Column(6) DoCmd.OpenReport strReport, acViewPreview ex: Exit Sub eh: If Err.Number = 2501 Then Call Step3Settings GoTo ex Else MsgBox Err.Description GoTo ex End If End Sub -----Original Message----- From: Charlotte Foust [mailto:cfoust at infostatsystems.com] Sent: Thursday, August 14, 2003 10:54 AM To: Access Developers discussion and problem solving Subject: RE: [AccessD] How to evaluate if report was cancelled due to no data You can trap an error 2501, which is what will be returned to the calling routine but that will only tell you it has been cancelled, not why. You could raise a custom event from the report and sink it in the calling form. That would let the report tell you why it was cancelled. Charlotte Foust -----Original Message----- From: Susan Geller [mailto:sgeller at cce.umn.edu] Sent: Thursday, August 14, 2003 7:35 AM To: accessd at databaseadvisors.com Subject: [AccessD] How to evaluate if report was cancelled due to no data XP. I have a form that opens a report. In the report, I have: Private Sub Report_NoData(Cancel As Integer) MsgBox "There are no data to display for the criteria you selected.", vbOKOnly, "DataMart" Cancel = True End Sub All's well. PROBLEM: The report cancels, and it goes back to the line right after the open report line of code. At that point, I want to evaluate to see if the report was cancelled so that I can do one thing if it was cancelled due to no data and do something else if it wasn't. How can I do this? --Susan Susan B. Geller Office of Information Systems College of Continuing Education University of Minnesota 306 Wesbrook Hall 77 Pleasant Street SE Minneapolis, MN 55455 Phone: 612-626-4785 Fax: 612-625-2568 _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com