Solved

Report to PDF file

Posted on 2014-12-20
11
177 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 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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
 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

838 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