I have some code to create a pdf from an access report. this works fine, however, i need it to save the file automatically.
here is my code:
when the report is opened (docmd.openreport "cases", acviewnormal.....) i would want to specify the output directory.
can any push me in the right direction?
Thanks!
Mr. Steve
here is my code:
Code:
'save default printer information to return to normal when done printing
Set OriginalPrinter = Application.Printer
'set pdf printer
Set Application.Printer = Application.Printers("Adobe PDF")
With rsContacts
Do Until rsContacts.EOF
strCaseID = rsContacts!CaseID
strCaseName = rsContacts!CaseName
strCaseSummary = rsContacts!CaseSummary
'MsgBox strCaseName & " " & strCaseSummary
'Change caption name - caption name is name pdf is saved as
DoCmd.OpenReport "Cases", acDesign, , "[caseid] = '" & strCaseID & "'" ', , strCaseID
Reports![Cases].Caption = strCaseName & ".pdf"
DoCmd.Save
DoCmd.Close acReport, "Cases"
'print to pdf writer
DoCmd.OpenReport "Cases", acViewNormal, , "[caseid] = '" & strCaseID & "'", , strCaseID
DoCmd.Close acReport, "Cases"
'move to next record
rsContacts.MoveNext
Loop
End With
Set Application.Printer = OriginalPrinter
when the report is opened (docmd.openreport "cases", acviewnormal.....) i would want to specify the output directory.
can any push me in the right direction?
Thanks!
Mr. Steve