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
It works just fine. In fact, I now have it so that it will run through the listbox and print out each one individually with no user intervention (other than pressing the "GO" button.
The code in the previous post will work to do them one at a time. If you want the new code that runs through the list, let me know.
Unfortunately, yes. It is the only way I have found to pass the name of the pdf file to be created. What I had to do was add a "pause" routine to wait long enough for the pdf writer to load and start processing. Once I got the right amount of paus time figured out, it worked like a charm.
Tim Gill
Gill Consulting
I'm using a control by Data Dynamics called Active Reports. Active Reports will export in Adobe PDF format. If you'd like, I can send you a report I created, or you can go to
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.