Link to home
Start Free TrialLog in
Avatar of chestera
chestera

asked on

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
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

if you are using A2007 or higher version, you can use

DoCmd.OutputTo acOutputReport, "rptHoistFaultReport", acFormatPDF,"C:\MyReports\Daily Inspection.pdf"
Avatar of chestera
chestera

ASKER

Rey Obrero

I am using A2003 for this project

Alan
SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Rey Obrero

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

Alan
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Gustav Brock

Just had a bad moment.
Ah ... time for holidays.

/gustav
Thank you Gustav and Rey for your help appreciated
You are welcome!

/gustav