[AccessD] Report Cancel Issue

Nicholson, Karen cyx5 at cdc.gov
Wed Dec 8 05:38:04 CST 2004


Private Sub Report_NoData(Cancel As Integer)
MsgBox "There is no data to print", vbInformation + vbOKOnly, "NoData
Cancellation"
Cancel = True
End Sub

If you're opening the report from code behind a form,   you need to
handle the error that's generated as a result.

Private Sub TestNoData_Click()
    On Error Resume Next
    DoCmd.OpenReport "SomeReport", acViewPreview
    If Err = 2501 Then Err.Clear
End Sub

Or, check the FMS detailed pitfalls documentation at:
http://www.fmsinc.com/tpapers/genaccess/reporttips.html

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht
Sent: Wednesday, December 08, 2004 1:47 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Report Cancel Issue



The message box is OK.

I am trying to kill the " The ReportOpen action was canceled box"  is
unwelcome. How can I make it go away.

Private Sub Report_NoData(Cancel As Integer)
    Dim lngRetval As Long
   DoCmd.SetWarnings False
   
    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
        Cancel = True
            End Select
            
       DoCmd.SetWarnings True

Thanks


JOE HECHT
LOS ANGELES CA 
 jmhla at earthlink.net


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list