If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back  dBforums > PC based Database Applications > Microsoft Access > Output Report in PDF Format with Customized File Name

LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Registered User
Join Date: Jul 2012
Posts: 3
Question Output Report in PDF Format with Customized File Name


I am trying to output a report using DoCmd.OutputTo with a customized file name based on a control on a form that is open. Not only can I not get my code to work, but my output goes to the printer! My intention is not to print the report but to save it as a pdf file with a filename that is customized and then have adobe reader automatically open the report for viewing. Please see my code below:

Private Sub Command8_Click()
On Error GoTo Err_Command8_Click

Dim OutputFileName As String

OutputFileName = "All_Queries_by_Study_And_Site" & Me.Combo4 '

DoCmd.OpenReport "All_Queries_by_Study_And_Site", acViewNormal, , , acWindowNormal
DoCmd.OutputTo acOutputReport, "All_Queries_by_Study_And_Site", acFormatPDF, OutputFileName, True, , , acExportQualityPrint

Exit Sub

MsgBox Err.Description
Resume Exit_Command8_Click

End Sub

Any and all help is very much appreciated!

Last edited by doopml; 12-17-12 at 14:05.
Reply With Quote
  #2 (permalink)  
Registered User
Join Date: May 2005
Location: Nevada, USA
Posts: 2,793
Well, the OpenReport line is what's printing it. You don't need that line based on what you're doing. You can use FollowHyperlink or Shell to open the PDF file after its created.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On