I have an Access VBA macro that generates a report, saves it in .pdf and then sends it by e-mail using CDO. Everything works fine if I run it manually or if I set it to be run on Task Scheduler with the security option "Run only when user is logged on". However, if I set the option to "Run whether user is logged on or not" (even with the option "Run with highest privileges") the program crashes on the second line of:
strFileFullPath = CurrentProject.Path & "\Test Report.pdf"
DoCmd.OutputTo acOutputReport, strReportName, acFormatPDF, strFileFullPath
with the error
Microsoft Access can't save the output data to the file you've selected.
I am pretty sure that this happens because the macro runs with other user in the background. I have been searching for a solution but all I have found is that it is not possible and that I should change for other printing methods, such as PDF Creator (which brings a lot of other issues).
I am using Access 2016 in Windows Server 2012 R2 Standard.