OutputTo not working..... (1 Viewer)

TajikBoy

Member
Local time
Today, 00:20
Joined
Mar 4, 2011
Messages
82
Hi guys,

After spending days searching for a solution for the OutputTo save a PDF file on a network drive failing miserably, I give up.....

Now, I need to find a solution, ie a VBA code which does the same, to create a PDF, name it as per the code and save it on a network folder provided in the code

Do you have any suggestions or samples which I can look and use?

Million thanks in advance,

Erol
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 15:20
Joined
May 7, 2009
Messages
19,169
can you just create the pdf on the local drive and copy it later to the network folder?
 

TajikBoy

Member
Local time
Today, 00:20
Joined
Mar 4, 2011
Messages
82
can you just create the pdf on the local drive and copy it later to the network folder?
but that would be manual work - thing is, after creating the PDF, I'm also adding a record to a table with hyperlink to the file location

So, I need this to be 100% VBA
 

Minty

AWF VIP
Local time
Today, 07:20
Joined
Jul 26, 2013
Messages
10,355
How have you mapped the network drive?
You should use a UNC path as it will work on any computer with access rights, rather than a mapped drive e.g.

\\Server1\Files\Userdocs

Should work from anywhere on your network

X:\UserDocs

May not.
 

TajikBoy

Member
Local time
Today, 00:20
Joined
Mar 4, 2011
Messages
82
How have you mapped the network drive?
You should use a UNC path as it will work on any computer with access rights, rather than a mapped drive e.g.

\\Server1\Files\Userdocs

Should work from anywhere on your network

X:\UserDocs

May not.
All checked, mapped correctly - all works on my machine, nad few others and does not work on majority...... I gave up on OutputTo - my hair went gray !
 

Minty

AWF VIP
Local time
Today, 07:20
Joined
Jul 26, 2013
Messages
10,355
The only other option is to show us your code and highlight where it goes wrong.
If you can include some debug.print of the designated folders / paths that would help.
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:20
Joined
Sep 21, 2011
Messages
14,050
but that would be manual work - thing is, after creating the PDF, I'm also adding a record to a table with hyperlink to the file location

So, I need this to be 100% VBA
Why would it be? You could do it all in VBA?
 

LarryE

Active member
Local time
Today, 00:20
Joined
Aug 18, 2021
Messages
562
Here is the code I use to output all open reports to PDF:
Code:
Dim rpt As Access.AccessObject
Dim ReportName As String
For Each rpt In Application.CurrentProject.AllReports
    With rpt
        If .IsLoaded Then
            'MsgBox rpt.Name
            DoCmd.SelectObject acReport, rpt.Name
            ReportName = rpt.FullName
            Dim Active As Report
            Set Active = Screen.ActiveReport
            With Active
                DoCmd.SelectObject acReport, ReportName
                DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, "\\Server1\Files\Userdocs\" & ReportName & ".pdf", , , ,  acExportQualityPrint
            End With
        End If
    End With
Next

I changed the output destination to your x drive as you indicated.
See if this works for you.
 

TajikBoy

Member
Local time
Today, 00:20
Joined
Mar 4, 2011
Messages
82
Here is the code I use to output all open reports to PDF:
Code:
Dim rpt As Access.AccessObject
Dim ReportName As String
For Each rpt In Application.CurrentProject.AllReports
    With rpt
        If .IsLoaded Then
            'MsgBox rpt.Name
            DoCmd.SelectObject acReport, rpt.Name
            ReportName = rpt.FullName
            Dim Active As Report
            Set Active = Screen.ActiveReport
            With Active
                DoCmd.SelectObject acReport, ReportName
                DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, "\\Server1\Files\Userdocs\" & ReportName & ".pdf", , , ,  acExportQualityPrint
            End With
        End If
    End With
Next

I changed the output destination to your x drive as you indicated.
See if this works for you.
OK, let me try this one also....
 

TajikBoy

Member
Local time
Today, 00:20
Joined
Mar 4, 2011
Messages
82
OK, let me try this one also....
Nope, no go for this one as well

Strangely, this one, although provided hard coded, still opens up a window asking where to save, this is something new in this saga....
 

Minty

AWF VIP
Local time
Today, 07:20
Joined
Jul 26, 2013
Messages
10,355
All checked, mapped correctly - all works on my machine, nad few others and does not work on majority...... I gave up on OutputTo - my hair went gray !
Can you show us your code as you have it, with the file paths exactly as typed?
We are all fishing in the dark here without seeing it.
 

LarryE

Active member
Local time
Today, 00:20
Joined
Aug 18, 2021
Messages
562
Nope, no go for this one as well

Strangely, this one, although provided hard coded, still opens up a window asking where to save, this is something new in this saga....
I left out the drive letter, but you probably need to provide it. Also, see if you can save it to your computer using:
DoCmd.OutputTo acOutputReport, ReportName, acFormatPDF, CurrentProject.Path & "\" & ReportName & ".pdf", , , , acExportQualityPrint

Make sure you have at least one report open when you try it. I have a button on my custom menu that runs it when I have any reports open.
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:20
Joined
Feb 19, 2002
Messages
42,981
It it a permissions problem? Have the user save the pdf to his local drive. If that works, the problem is with his permissions to the network drive. If that still doesn't work - you do need to define what "doesn't work" means, then the problem is probably that they don't have any software installed that can create a PDF>
 

Users who are viewing this thread

Top Bottom