Need access vba to print all pdf files in folder

Just need code to print all .pdf files generated to folder.  How could I add that feature to not only print to file but also print out individual reports?

Sub PDFtoFileDentalReports()

    Dim db As DAO.Database
    Dim RS As DAO.Recordset
    Dim MyFileName As String
    Dim mypath As String
    Dim temp As String

        mypath = "C:\Users\u347867\Desktop\PrinttoPDF\DENTAL\"

        Set db = CurrentDb()

        Set RS = db.OpenRecordset("SELECT [Producer_Number] FROM [qdr_RDC_DENTAL]")

    Do While Not RS.EOF

        temp = RS("Producer_Number")

            MyFileName = RS("Producer_Number") & ".PDF"

        DoCmd.OpenReport "r_RDC_2015_DENTAL_SALES_BONUS", acViewReport, , "[Producer_Number]='" & temp & "'"

DoCmd.OutputTo acOutputReport, "r_RDC_2015_DENTAL_SALES_BONUS", acFormatPDF, mypath & "RDC_2015_DENTAL_SALES_BONUS_" & MyFileName

DoCmd.Close acReport, "r_RDC_2015_DENTAL_SALES_BONUS"

Set RS = Nothing
Set db = Nothing

    'MsgBox "2015 RDC Health Sales Bonus Report Printout Complete", vbOKOnly, , ReportFilter
End Sub
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

deer87Author Commented:
Currently using the code above to print Access report to pdf file based on distinct producer number but need to add additional vba code to print out each pdf file sent to the folder.
Jeffrey CoachmanMIS LiasonCommented:
Remember that the PDF output is theoretically the same as the Report itself, (In effect, ...A PDF stores the printer output codes to a file) printing the report will be the same as printing the PDF.
So you can change this code:
 DoCmd.OpenReport "r_RDC_2015_DENTAL_SALES_BONUS", acViewReport, , "[Producer_Number]='" & temp & "'"

Open in new window

 DoCmd.OpenReport "r_RDC_2015_DENTAL_SALES_BONUS", acViewNormal , , "[Producer_Number]='" & temp & "'"

Open in new window

...or simply add this "Print" line after (or before) the existing code to open/display the report...

This would be far simpler than creating code to loop the folder and print each PDF...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Execute Adobe Reader as external application with "/t" switch:
Sub Printpdf(Filename As String)
  Dim RetVal
  Dim Cmd As String

  Cmd = "c:\Program Files (x86)\Adobe\Reader 11.0\Reader\Acrord32.exe /t " & Filename
  RetVal = Shell(Cmd, 1)
End Sub

Open in new window

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

deer87Author Commented:
Jeffrey CoachmanMIS LiasonCommented:
glad I could help
deer87Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.