Solved

Report to PDF file

Posted on 2014-12-20
11
179 Views
Last Modified: 2014-12-26
Hi EE

I have the following

Dim blRet As Boolean
Dim search, Tfilename
Tfilename = "Daily Inspection"
blRet = ConvertReportToPDF("rptHoistFaultReport", vbNullString, Tfilename & ".pdf", True, True, 150, "", "", 0, 0, 0)

The above creates an PDF file and then opens a dialog box for the user to choose a location to save.
Is there away to  auto save to a specified location with a given file name without the dialog box

for example
FileSave  = "C:\MyReports\Daily Inspection.pdf

Any help appreciated

chestera
0
Comment
Question by:chestera
[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
  • 5
  • 4
  • 2
11 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40511336
if you are using A2007 or higher version, you can use

DoCmd.OutputTo acOutputReport, "rptHoistFaultReport", acFormatPDF,"C:\MyReports\Daily Inspection.pdf"
0
 

Author Comment

by:chestera
ID: 40511342
Rey Obrero

I am using A2003 for this project

Alan
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 40511352
then, possibly by modifying the function "ConvertReportToPDF"
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:chestera
ID: 40511384
Rey Obrero

That is the problem I am not sure how to or if it can be done in A2003. Appreciate your help

Alan
0
 
LVL 50

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 40511506
1. Make a backup of your database.
2. Go to function ConvertReportToPDF.
3. Insert after the Dim statements:

    Tfilename = "YourFixedFilename.pdf"

4. Save, compile, and test.

You will still have to call the function with a filename as you do now, but it can be any filename as it now will be ignored.

/gustav
0
 

Accepted Solution

by:
chestera earned 0 total points
ID: 40512145
Gustav Brock

I have found the answer

blRet = ConvertReportToPDF("rptHoistFaultReport", vbNullString, Tfilename & ".pdf", False, True, 150, "", "", 0, 0, 0)

Staring me in the face all the time
Just make Tfilename = "C:\Reports\File.pdf"

Alan
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40512480
Then I don't know what you asked about. It is identical to your original code:

    Tfilename = "Daily Inspection"

> Just make Tfilename = "C:\Reports\File.pdf"

If you do so, and call the function like you did:

    ConvertReportToPDF("rptHoistFaultReport", vbNullString, Tfilename & ".pdf", True, True, 150, "", "", 0, 0, 0)

the saved file will be named:

    C:\Reports\File.pdf.pdf

which probably is not what you want.

/gustav
0
 

Author Comment

by:chestera
ID: 40512789
Gustav Brock

Just had a bad moment.
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40512790
Ah ... time for holidays.

/gustav
0
 

Author Closing Comment

by:chestera
ID: 40518299
Thank you Gustav and Rey for your help appreciated
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 40518321
You are welcome!

/gustav
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net dbnull syntax 1 59
Form performance table vs. query 27 72
Return Data From Website in Access 6 59
Convert MS Access Excel Routine to Late Binding 6 28
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

752 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