Bobby Heid
bheid at appdevgrp.com
Fri Dec 10 07:22:27 CST 2004
You have to have the error trapping code in the location where the report is called. In the OnNoData event in the report, you need to set cancel to true. Example: Private Sub Report_NoData(Cancel As Integer) Cancel = True End Sub Function PreviewReport() On Error GoTo Proc_Err DoCmd.OpenReport "TCR", acPreview, "", "" Proc_Exit: Exit Function Proc_Err: If Err.Number = 2501 Then 'no data MsgBox "There is no data to display.", vbInformation + vbOKOnly Else 'err handling code goes here End If Resume Proc_Exit End Function Hope this helps, Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht Sent: Thursday, December 09, 2004 10:56 PM To: 'Access Developers discussion and problem solving'; 'ACCESS-L' Subject: [AccessD] Still cant kill the cancel messgae in No Data Event Thanks Karen, I tried your code. It did not work. I still get report action has been canceled. How do I make it go away. On Error GoTo PROC_ERR 'TVCodeTools ErrorEnablerEnd Dim lngRetval As Long lngRetval = MsgBox( "There are no products requiring a QAIP Form in for this Purcase Order.", _ vbOKOnly + vbInformation + vbSystemModal + vbDefaultButton1, _ "No QAIP for this PO") Select Case lngRetval Case vbOK pintCancel = 1 End Select 'TVCodeTools ErrorHandlerStart PROC_EXIT: Exit Sub PROC_ERR: MsgBox Err.Description Resume PROC_EXIT 'TVCodeTools ErrorHandlerEnd End Sub JOE HECHT LOS ANGELES CA jmhla at earthlink.net