Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2007 print error: 2501 The openreport action was cancelled

Status
Not open for further replies.

aldi

IS-IT--Management
May 10, 2002
421
0
0
CA
Hello all,

I have a small application in MS Access 2000 that I want to move to MS Access 2007.

The application is running fine in 2000 but when I run it in 2007 I get the following error:

"The openreport action was cancelled. Error: 2501"

I can see that the print job gets to the print queue gets processed and disappears, but nothing comes out of the printer. I tried different printers with different drivers but no luck.

Any help would be greatly appreciated,

Thanks in advance,

Here's the code:

Code:
Public Function PrintWorkOrder()
On Error GoTo Err_PrintWorkOrder
      Dim stDocName As String
      
      stDocName = "rptWOPlant"
      DoCmd.OpenReport stDocName, acViewNormal    
      
      stDocName = "rptWOPacking"
      DoCmd.OpenReport stDocName, acViewNormal    
      
      stDocName = "rptWOOffice"
      DoCmd.OpenReport stDocName, acViewNormal    

Exit_PrintWorkOrder:
      Exit Function
Err_PrintWorkOrder:
      MsgBox Err.Description, vbOKOnly, "Error: " & Err.NUMBER
Resume Exit_PrintWorkOrder
End Function
 
Also, when the print job is in the queue the status says: "spooling" and then disappear. It never gets to say status printing as it does with regular printing jobs.

Please help. I have days dealing with this and I want to start moving from ms access 2000 to 2007

Thanks,

Aldi
 
I also modified the error trapping but still no luck.

HELP PLEASE!!!!

Code:
Exit_PrintWorkOrder:
      Exit Function
Err_PrintWorkOrder:
      If Err.NUMBER = 2501 Then
        Resume Next
      Else
        MsgBox Err.Description, vbOKOnly, "Error: " & Err.NUMBER
      End If
Resume Exit_PrintWorkOrder
End Function
 
What happen if you replace acViewNormal with acViewPreview ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV Thanks a lot for posting!!!!

When I replace acViewNormal with acViewPreview. The report preview shows briefly on the screen then it disappear on its own.

I hope this gives you an idea of what's is going on.

Thanks again,

Aldi
 
PH, I USB-connected a printer directly to my computer (Samsung SCX-4521F), but still doesn't work.

With the configuration above the status in the printer queue first it says "spooling" then it says "deleting-spooling".

Any idea what's wrong?

Thanks in advance,

Aldi
 
Hi DHOOKOM, thanks for posting.

Yes I have code in the report.

Here's the code:

Code:
Option Compare Database
Option Explicit

Private Sub Report_Open(Cancel As Integer)
      'hide page footer section if there aren't special instructions
      If Not IsNull(Forms![frmWorkOrder].[txtSPECIALINSTRUCTIONS]) Then
            Me.Section(4).Height = gstrTextHeight + (0.8 * 1440)
      Else
            Me.Section(4).[Visible] = False
      End If
 End Sub

Private Sub Report_Page()
      'show page header (section3) for pages other than page one
      'hide page footer (section4) after special instructions were printed on first page
      Me.Section(3).[Visible] = True
      Me.Section(4).[Visible] = False
End Sub

Thanks in advance,

Aldi
 
DHOOKOM, I can't open the report on its own. It gives me the debuging window, because it expects data from the form work order.

Please note that the original application code was written in A2000 and I'm trying to run it in A2007.

Any ideas what to try?

Thanks in advance,

Aldi
 
I think you can simply trap this error

Exit_PrintWorkOrder:
Exit Function
Err_PrintWorkOrder:
If Err.Number = 2501 Then
Resume Next
Else
MsgBox Err.Description, vbOKOnly, "Error: " & Err.NUMBER
end if
Resume Exit_PrintWorkOrder

 
Hi MajP and thank you for posting!

I have the error trap in my function.

Isn't the code below the error trap? That's what I have in my function

Do I need to add anything else to it?

Please let me know,

Thanks in advance,


Code:
Exit_PrintWorkOrder:
      Exit 
FunctionErr_PrintWorkOrder:
      If Err.NUMBER = 2501 Then
        Resume Next
      Else
        MsgBox err.Description,vbOKOnly, "Error: " &
            Err.NUMBER
      End If
Resume Exit_PrintWorkOrder
End Function
 
Sorry. I read the original post and did not see your 3rd post.
 
Apologies to all members for no getting back until now. I got busy with something else on the weekend and yesterday.

dhookom, I tried running the report as you said in the last post, but I get errors:

"A custom macro in this report has failed to run, and is preventing the report from rendering."

"This error occurs when an event has failed to run because Microsoft Office Access cannot
evaluate the location of the logic for the event. For example, if the OnOpen property of
a form is set to =[Field], this error occurs because Access expects a macro or event name
to run when the event is fired."

Any other ideas?

Thanks in advance,

Aldi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top