Solved

Access 2007 Report

Posted on 2010-09-09
6
336 Views
Last Modified: 2012-06-21
I have a Access 2007 report that I want to convert to PDF and then save. I want the save as dialog box to come up so the user can choose a folder to save it to. I am using a macro (specs below) to create the PDF and tried using the msofiledialogsaveas to open the dialog box. the trouble is, I can't get them to work together.

Object Type:  Report
Object Name:  rptPendingDateChanges
Output Format: PDF Format(*.pdf)
output file:  had a path and file name here before
auto start: NO
Template File:  
Encoding:  
Output Quality: Print
0
Comment
Question by:LeLeBrown
[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
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:Remi Gelinas
ID: 33642213
Hello,

If you are using the "Microsoft Office Save as PDF Plug-in", you can setup the "Adobe PDF" printer to ask for file prompt before printing the file  (right click your adobe printer in your printer list and show properties, go in the general tab).
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33642246
the macro can not take variables. To make this work using the msofiledialogsaveas, you have to create a function in vba.

post the codes you are using with the msofiledialogsaveas.

you can do this without using a macro if you want.
0
 

Author Comment

by:LeLeBrown
ID: 33642357
Capricorn1,

with msofiledialogsaveas i just have that statement right now. it has been a while since I have created a file in Access. All I have right now is below.

DoCmd.SetWarnings False
 strStatus = SysCmd(acSysCmdSetStatus, "Creating report, please wait ...")
 DoCmd.RunMacro "ReportToPDF"
     strStatus = SysCmd(acSysCmdClearStatus)


Set dlgOpen = Application.FileDialog(msoFileDialogSaveAs)
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 33642588
create a command button in a form and name it cmdSavePDF

in the click event of the button place the code like this

you have to add to your references Microsoft office xx.x object library

Private Sub cmdSavePDF_Click()
On Error GoTo SavePDFerr
Dim dlgOpen As Office.FileDialog, pdfFile As String
Set dlgOpen = Application.FileDialog(msoFileDialogSaveAs)
With dlgOpen
    .AllowMultiSelect = False
    .Title = "Save PDF file"
    .Show
    pdfFile = .SelectedItems(1)
End With
If Len(pdfFile & "") > 0 Then
DoCmd.OutputTo acOutputReport, "rptPendingDateChange", acFormatPDF, pdfFile, , , , acExportQualityPrint

End If
Exit_SavePDF:
    Exit Sub

SavePDFerr:
    If Err.Number = 5 Then
        Err.Clear
        Else
        MsgBox Err.Description
    End If
        Resume Exit_SavePDF

End Sub

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33642751
or you can use this sample db
dbSavePDFAs.mdb
0
 

Author Comment

by:LeLeBrown
ID: 33642934
Capricorn1,

Thanks!!  This worked great!
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

628 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