• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 93
  • Last Modified:

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
0
pdvsa
Asked:
pdvsa
  • 4
  • 2
1 Solution
 
Nick67Commented:
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?
0
 
pdvsaAuthor Commented:
I have 2010.  It is PDF
0
 
Rey Obrero (Capricorn1)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
    .Filters.Clear
    .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

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
pdvsaAuthor Commented:
I haven't tested but I know it must be right if Rey responded.   Good enough for me!!
0
 
pdvsaAuthor 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

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

strReport = "myReport"
0
 
pdvsaAuthor Commented:
ahhh.  Works.  Thank you sir...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now