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
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