Solved

Report to PDF file

Posted on 2014-12-20
11
174 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
  • 5
  • 4
  • 2
11 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
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 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
ID: 40511352
then, possibly by modifying the function "ConvertReportToPDF"
0
 

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 49

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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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 49

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 49

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 49

Expert Comment

by:Gustav Brock
ID: 40518321
You are welcome!

/gustav
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now