I am working on this right now. I have a list of source codes, and I want a separate report for each code exported to a PDF. Here's where I am:
I have a form with a listbox listing all possible source codes. The listbox has two columns: Code, Description.
I have PDF Writer as my default printer.
I can pick a code from the list, and it will open the report, print it to the PDF writer, and provide the filename (from the description column), then send the enter key.
It uses the following code:
Dim varItem As Variant
Dim stDocName As String
stDocName = "rptAbstracts"
varItem = Me.lstSponsors.Column(1) & Chr(10)
SendKeys varItem, False
DoCmd.OpenReport stDocName, acNormal, , "[SponsorID] = " & Me.lstSponsors.Column(0)
Keep in mind, you have to have the PDF writer as the default printer.
Let me know if you ahve any questions.
Tim Gill
Gill Consulting