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
chesteraAsked:
Who is Participating?
 
chesteraConnect With a Mentor Author 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
 
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Rey Obrero (Capricorn1)Connect With a Mentor Commented:
then, possibly by modifying the function "ConvertReportToPDF"
0
 
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 BrockConnect With a Mentor CIOCommented:
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
 
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
All Courses

From novice to tech pro — start learning today.