I have just rebuilt a Win7 PC and at the same time switched from Access 2010 to Access 2013. One of my databases which saves PDF files to the local machine is now throwing runtime errors.
This is the code:
Dim mypath As String
mypath = Environ("userprofile")
Dim pdfPath As String
pdfPath = mypath & "\gbis-orders\GBIS Order No " & Me.orderid.Value & ".pdf"
Dim rptName As String
rptName = "rptSalesOrder"
DoCmd.OutputTo acOutputReport, rptName, acFormatPDF, pdfPath, , , , acExportQualityPrint
MsgBox "GBIS Order No " & Me.orderid.Value & " Saved." & vbCrLf & vbCrLf & "LOCATION: " & pdfPath, vbInformation, "PDF Created."
The attached image shows us that the environment variable is being picked up okay too.
The actual error is run-time error 2501 the OutputTo action was cancelled.
If anyone can help with this I'd be grateful!