Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Save reports in certain directory

Posted on 2014-12-19
7
Medium Priority
?
92 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
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.

 

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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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