?
Solved

Save reports in certain directory

Posted on 2014-12-19
7
Medium Priority
?
90 Views
Last Modified: 2014-12-20
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
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 26

Expert Comment

by:Nick67
ID: 40510079
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
 

Author Comment

by:pdvsa
ID: 40510181
I have 2010.  It is PDF
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40510228
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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:pdvsa
ID: 40510408
I haven't tested but I know it must be right if Rey responded.   Good enough for me!!
0
 

Author Comment

by:pdvsa
ID: 40510972
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
 
LVL 120

Expert Comment

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

strReport = "myReport"
0
 

Author Comment

by:pdvsa
ID: 40511007
ahhh.  Works.  Thank you sir...
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question