Save reports in certain directory

How can I default the directory to save reports?  I know I can direct new database to be saved in a certain folder (Access Options, General, Default db folder) but I am wondering if I can save reports in a certain directory without changing the default db directory.  

thank you
pdvsaProject financeAsked:
Who is Participating?
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
use this codes

Sub SaveReport()
Dim folderPath As String, strReport As String
strReport = "myReport"
folderPath = SelectFolder()

If folderPath & "" <> "" Then
    DoCmd.OutputTo acOutputReport, strReport, acFormatPDF, folderPath & "\myreport.pdf"
End If
End Sub

Open in new window

code to select the folder

Function SelectFolder() As String
Dim fd As Object, strTitle As String
Set fd = Application.FileDialog(4)
strTitle = "Select Folder"
With fd
    .AllowMultiSelect = False
    .ButtonName = Left(strTitle, InStr(strTitle, " ") - 1)
    .InitialView = 1
    .Title = strTitle
    If .Show Then
        SelectFolder = .SelectedItems(1)
    End If
End With
End Function

Open in new window

save reports in a certain directory
In what sense, and in what version of Access?
I take it you mean saving them out as PDF files.
What mechanisms are you using now to do that?
pdvsaProject financeAuthor Commented:
I have 2010.  It is PDF
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

pdvsaProject financeAuthor Commented:
I haven't tested but I know it must be right if Rey responded.   Good enough for me!!
pdvsaProject financeAuthor Commented:
Rey, I placed the codes on a button on the report.  I do have an error as shown below.  Let me know what you think.  

After I press the button, I select the folder and next is when I get the error.  

thank you

Rey Obrero (Capricorn1)Commented:
you have to change "myReport" with the name of your report on this line

strReport = "myReport"
pdvsaProject financeAuthor Commented:
ahhh.  Works.  Thank you sir...
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.