AC2k ADP Form Report Cancel error not handled

B

BJ Freeman

when I do a report and click on the cancel button, I get a error msg, 2501
The openreport was canceled then wants to end or put me in debug mode.
the message is not directed to my error handling.
the error happens with DoCmd.OpenReport line.
any help appreciated.
here is the code:
Private Sub PreviewInvoice_Click()
On Error GoTo Err_PreviewInvoice_Click
If Forms![Orders by Customer]![Orders by Customer
Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter order information before previewing invoice."
Else
' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.OpenReport "Invoice", acPreview, , "[OrderID] = Forms![Orders
by Customer]![Orders by Customer Subform].form![OrderID]"
End If

Exit_PreviewInvoice_Click:
Exit Sub

Err_PreviewInvoice_Click:
If ERR <> 2501 Then
MsgBox ERR.Description
End If
Resume Exit_PreviewInvoice_Click
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top