The OpenReport action was cancelled using ACCESSRT

martin.duplessi

New member
Local time
Today, 02:10
Joined
Sep 27, 2006
Messages
3
Hi,
I am getting the following error "The OpenReport action was cancelled" when printing a report using the command docmd.OpenReport.

I have installed the printer and all the drivers. The printer has been shared as "LPT1". The printer prints fine from other applications.

The specific report prints from my development machine (with MS Access installed). The problem is occurring on another PC with ACCESSRT installed.

I have encountered the same problem on 2 PC's (with ACCESSRT installed), so it is not PC specific.

My assumption is that the problem is related to ACCESSRT, but I am hoping it is user related.

Any assistance would be appreciated.

Regards.
Martin.
 
if you open a report with code, and eg theres no data, so the onnodata event in the report cancels the open event, you get a 2501 error, of the sort you describe. so, in your form, activate the onerror event, and trap a 2501 error to see if thats whats causing it.
 
Thankyou for your suggestion.

I originally had an onerror event activated, but there was no error when printing the report other than "The OpenReport action was cancelled".

Other forums have suggested switching the onerror event off and using "On Error Resume Next" instead. No luck.

Attached is my code fyi:

Private Sub PrintInvoice_Click()
On Error GoTo Err_PrintInvoice_Click

Dim stDocName, stLinkCriteria As String

Set Application.printer = Application.Printers("Star TSP100 Cutter (TSP143)")

stDocName = "Invoice"
stLinkCriteria = "TransHeaderID=" & Me!TransHeaderID
DoCmd.OpenReport stDocName, acViewNormal, , stLinkCriteria
Me!InvoicePrinted = -1

Exit_PrintInvoice_Click:
Exit Sub

Err_PrintInvoice_Click:
MsgBox Err.Description
Resume Exit_PrintInvoice_Click

End Sub
 
In your options change to "Break on all Errors"
When the error message pops up, choose "Debug", which will take you to the VB editor.
Then you can hover over your variables and control references and see what they actually are at that point, to see if the results are different than what you expect.

** IMMPORTANT ** Remeber to go back to your options and uncheck "Break on all Errors" so that your error handler will take back over.
 
i think you are getting an error message

your code

Err_PrintInvoice_Click:
MsgBox Err.Description
Resume Exit_PrintInvoice_Click

is what is producing your error message. Change this to msgbox("Error " & err & " Desc: " & err.description), and you will probably see the error number 2501.

Something is stopping your report printing. Try changing acviewnormal to acpreview and see what happens. Put a breakpoint at the top of the code, (clcik in the left margin and you will see a brown dot). The when your code gets interrupted press F8 a line at a time to see where your code is failing and jumping to the error handler.
 

Users who are viewing this thread

Back
Top Bottom