Trying to send a report in PDF format to an established folder on computer

SteveL13
SteveL13 used Ask the Experts™
on
I am trying to send a report in PDF format to an established folder on computer.  The folder path is

strClientAppealsAttachmentFolderDataPath

which I know is a real path because I debug.print it.

I really don't want to preview the report, just send it to the folder.

Here is my code:

DoCmd.OpenReport "rptBillOfLading", acViewPreview, , , acHidden
DoCmd.OutputTo acOutputReport, "rptBillOfLading", acFormatPDF, strClientAppealsAttachmentFolderDataPath

Open in new window


but I get an The OutputTo action was cancelled and the report preview but I don't want it to.

????
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Make sure you have full rights to copy things into that folder.
try first using FileCopy method to that location, see what happens.

Author

Commented:
I do have full rights.  And please remember, I don't want to preview the report.  Just copy it to the directory.
Owner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010
Commented:
if you don't want to preview the report, why area you opening it?

I would agree with bfuchs, that the likely problem would be that you cannot write into the folder you are attempting to.  But additionally the name of that variable is:

strClientAppealsAttachmentFolderDataPath

which implies a path (not a file name), so you might need to append a file name to that path.

Dale
I do have full rights.
Some times you may have rights to do it manually but when comes to do it within code it may not work.
Please try FileCopy first just to determine if thats not the issue, like folliowing
FileCopy("C:\text.txt", "C:\text2.txt") 

Open in new window

Author

Commented:
Got it.  I had to change this:

strClientAppealsAttachmentFolderDataPath

to this:

strClientAppealsAttachmentFolderDataPath & "\rptReportName.PDF"

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial