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

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.

????
SteveL13Asked:
Who is Participating?
 
Dale FyeCommented:
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
0
 
bfuchsCommented:
Make sure you have full rights to copy things into that folder.
try first using FileCopy method to that location, see what happens.
0
 
SteveL13Author Commented:
I do have full rights.  And please remember, I don't want to preview the report.  Just copy it to the directory.
0
 
bfuchsCommented:
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

0
 
SteveL13Author Commented:
Got it.  I had to change this:

strClientAppealsAttachmentFolderDataPath

to this:

strClientAppealsAttachmentFolderDataPath & "\rptReportName.PDF"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.