Output to action cancelled (1 Viewer)

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
Hi everyone.

On several reports on 2 different databases, users are getting "The Output to Action was cancelled:2501" message when trying to save a report as PDF via OutputTo action. Equally when trying to manually save as PDF they get "cant save the output data to the file you've selected" (on this none of the suggestions apply eg. file is not open, it's not a template, there is free disk space, file does not exist - i'm saving it {although see next sentence in red}!, write permissions exist). The WEIRD bit though is if you go to the folder the file is there. When you click OK on the error message the file disappears! Currently users copy and paste the file before clicking OK.
We have just upgraded to Windows 10, although 1 user did have this problem intermittently on Windows 7. I wonder if there is some sort of delay/slow sync issue?

OS: Windows 10
BE: Sharepoint Server 2013
FE: Users own PC
 

Ranman256

Well-known member
Local time
Today, 11:35
Joined
Apr 9, 2015
Messages
4,337
Is it possible it's open but not visible?
This can only be seen in the Task Manager,showing the PDF reader open in it.
 

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
Cheers Ranman for the suggestion. I have just checked and the PDF reader is not open in Task Manager.:confused:

I also just tried saving to desktop and that works! Further suggests network/server issue?
 

Minty

AWF VIP
Local time
Today, 16:35
Joined
Jul 26, 2013
Messages
10,374
If you are trying to save into a root folder or root you will find Windows 10 very unhelpful.
On your network are you using a \\YourServerShare\sharedfolder\path or Networked drive path S: Q: ?

The first method seems much more successful.
Also what version of Acrobat, DC gave me no end of grief...
 

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
Sorry for the delay in replying.

I have to admit i am lazy and use LFS paths:eek:
I have amended the code to use UNC but it still falls over:confused:

is my outputto code correct?
Code:
DoCmd.OutputTo acOutputReport, "ShippingForm", "PDFFormat(*.pdf)", FileName(), False, "", , acExportQualityPrint

FileName is a function, ala;
Code:
FileName = "\\server\Documents\Operations\Suppliers\Logistics\Shipper\" & Me.suppID & "\" & Me.suppID & " - " & Me.tbDest & " WK" & Format(Me.shpSail - 7, "ww") & " Sail " & Format(Me.shpSail, "dd.mm.yy") & ".pdf"

Looking around, i found this article on answer.microsoft (or NOanswers.microsft! :banghead:)

http://answers.microsoft.com/en-us/office/forum/office_2016-access/access-2016-accde-docmdoutputto-acoutputreport/19a44734-f4a4-446c-8f8f-c54cde7183ec?page=1

Just restarted one of the databases and attempted the output operation, but it failed :rolleyes:
 

Minty

AWF VIP
Local time
Today, 16:35
Joined
Jul 26, 2013
Messages
10,374
I'm pretty sure it won't like the periods in your dd.mm.yy formatting in the file name. Use underscores - personally I'd remove any spaces anywhere to ensure a simple life.
 

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
I have reworked the naming convention for the outputted files to exclude any spaces and periods. I have used UNC paths also.
Code:
FileName = "\\server\Company\Documents\Operations\Suppliers\Logistics\Shipper\" & Me.suppID & "\" & Me.suppID & "-" & Me.tbDest & " WK" & Format(Me.shpSail - 7, "ww") & "_Sail_" & Format(Me.shpSail, "ddmmyy") & ".pdf"
But no success. It will not export either by code OR manually to a server location (AFTER 8 minutes:banghead:). Desktop - no problem.

The IT team are looking at this in case it is a permissions/server issue.
 

Minty

AWF VIP
Local time
Today, 16:35
Joined
Jul 26, 2013
Messages
10,374
I hate being a pedant (well not really ;) ) but you still have a " WK" with the space.
I doubt this is any issue though. It definitely sounds like a permissions issue.

Out of interest where is the Access DB held on the local machine is it within Documents or is it in root? and what permissions is Access being run with? I had some strange issues when Access was run as admin it wouldn't do certain things. (Which is possibly the opposite of what you would expect.)
 

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
The FE's are usually on the users desktop or in the C:\Users\Name\Documents folder.

Access is run with normal permissions, eg you have to enable content first time you open.

My biggest bug bare is how sometimes it works:D;):p:rolleyes::eek: and sometimes it don't:banghead::banghead::banghead::banghead::mad:
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:35
Joined
Sep 12, 2006
Messages
15,709
you get a 2501 error in a variety of cases when a report/form fails to open.

Are you sure THIS user created the pdf. Could it be another user. I struggle to see how you can create the file AND also get a 2501

are you opening the report AND then generating the pdf. maybe that is the problem. Can we see all the code, including the error handling.
 

MarkK

bit cruncher
Local time
Today, 08:35
Joined
Mar 17, 2004
Messages
8,185
Also, to troubleshoot, can you just print the report successfully? Don't bother with the PDF part for the moment.
 

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
MarkK, yes the report prints no problem.

I struggle to see how you can create the file AND also get a 2501
Welcome to my confusion.
In the manual method, I/the user opens the report, clicks PDF or XPS on the Data tab of the ribbon, navigate to the preferred location to save and hit save. That is when the error message pops up BUT in windows explorer you can see the PDF until you dismiss the error message. In the automated method the report is not opened.

The relevant code is below;
Code:
Private Sub Command198_Click()
'book shipping
On Error GoTo Command198_Click_Err

DoCmd.SetWarnings False

Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
    
    DoCmd.OutputTo acOutputReport, "ShippingForm", acFormatPDF, [COLOR="Blue"]FileName()[/COLOR], False, "", , acExportQualityPrint
    
    [COLOR="Purple"]SendEmail[/COLOR]
    
Command198_Click_Exit:
    
    DoCmd.OpenQuery "qryPO_Processing_Shipping_Order"
    DoCmd.OpenQuery "qryPO_Processing_Clear"
    
    DoCmd.SetWarnings True
    
    Forms!Purchase_Orders_List.Requery
    DoCmd.Close acForm, Me.Name
    Exit Sub

Command198_Click_Err:

    MsgBox Err.Description & vbLf & Err.Number
    Resume Command198_Click_Exit
End Sub

Filename() is a function;
Code:
Function FileName() As String

FileName = "\\server\Company\Documents\Operations\Suppliers\Logistics\Containerships\" & Me.suppID & "\" & Me.suppID & "-" & Me.tbDest & "_WK" & Format(Me.shpSail - 7, "ww") & "_Sail_" & Format(Me.shpSail, "ddmmyy") & ".pdf"

End Function

SendEmail is a custom procedure for generating emails;
Code:
Sub SendEmail()

Dim OL As Outlook.Application
Dim MyItem As Outlook.MailItem
Dim strAtt As String

strAtt = FileName()

    Set OL = New Outlook.Application
    Set MyItem = Outlook.Application.CreateItemFromTemplate("C:\Users\" & GetUser & "\AppData\Roaming\Microsoft\Templates\bookings.oft")
    
    With MyItem
        .To = "Export.lv@containerships.lv"
        .Subject = "bookings WK" & Format(Format(Me.shpColl, "WW") - 1, "00") & " - " & Me.suppID & " - " & Me.tbDest
        .HTMLBody = "Good afternoon," & Chr(12) & Chr(12) & "Please see attached booking form for collection next week."
        .Attachments.Add strAtt
        .Display
    End With
    
    Set MyItem = Nothing
    Set OL = Nothing
    
End Sub

I have now removed all spaces, periods, slashes etc.When i processed some bookings this morning, the first form failed, but subsequently worked, as did the remaining forms first time.

I have passed this to the company IT team now. Seeing how all of this worked fine before changing to Windows 10 AND upgrading to Windows Exchange server 2012 or 2013. It has to be an issue there and not with my code or Access itself.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:35
Joined
Sep 12, 2006
Messages
15,709
right

maybe sendemail needs to wait until the pdf production has completed. that might be the problem. The email can't use the pdf.

can you put a delay loop after docmd.outputto

Code:
while dir(pdffilename)=""
    doeevents
wend
 

Isskint

Slowly Developing
Local time
Today, 16:35
Joined
Apr 25, 2012
Messages
1,302
Just an update for you all on this one.

The IT team cannot identify any reason behind these issues :banghead:

However, they did find that by saving to file locally and then using FileCopy to transfer it to the 'correct' folder on the server, everything is fine.

I have marked this as solved due to this work around.
 

Users who are viewing this thread

Top Bottom