Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Report to PDF file

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
chestera
Asked:
chestera
  • 5
  • 4
  • 2
3 Solutions
 
Rey Obrero (Capricorn1)Commented:
if you are using A2007 or higher version, you can use

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

I am using A2003 for this project

Alan
0
 
Rey Obrero (Capricorn1)Commented:
then, possibly by modifying the function "ConvertReportToPDF"
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
chesteraAuthor Commented:
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
 
Gustav BrockCIOCommented:
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
 
chesteraAuthor Commented:
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
 
Gustav BrockCIOCommented:
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
 
chesteraAuthor Commented:
Gustav Brock

Just had a bad moment.
0
 
Gustav BrockCIOCommented:
Ah ... time for holidays.

/gustav
0
 
chesteraAuthor Commented:
Thank you Gustav and Rey for your help appreciated
0
 
Gustav BrockCIOCommented:
You are welcome!

/gustav
0

Featured Post

Independent Software Vendors: 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!

  • 5
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now