Automating Reports Print to File in PDF format 
Author Message
 Automating Reports Print to File in PDF format

Hi all,

I have a report that produces an invoice for a customer.  I have about
2000 customers.
What I would like to do is something along the lines of:

SQLString = "SELECT DISTINCT custNo FROM Customer"

Set rs = db.OpenRecordset(SQLString)
rs.MoveFirst

While Not rs.EOF
        [Print a report Called "CustomerReport" to a file named
Rpt"&rs("CustNo")&".pdf"]
        rs.MoveNext
Wend

If I use:

DoCmd.SelectObject acReport, "Certificate", True
DoCmd.PrintOut

I get that darn dialog box that wants me to type in the filename.  I
want to be able to avoid this dialog box and set the filename and move
on to the next one.

Any ideas?

Thanks,
Anna

Anna Deak
MDR Technologies Inc.
(905) 829-3317 Ext. 109



Mon, 02 Sep 2002 03:00:00 GMT  
 Automating Reports Print to File in PDF format
There is some code on Dev Ashish's site http://www.mvps.org/access/ on how
to save a report's output to a PDF file.

Also saw this reply to a similar question:

Quote:
>Bob:

>Stop by our site and look in the developer products section for our "Email
>and PDF Creator" library for Access.  It will allow you to specify the file
>name via code so the dialog doesn't pop up.  Really easy to use.

>HTH
>--
>Steve Arbaugh
>ATTAC Consulting Group
>http://ourworld.compuserve.com/homepages/attac-cg



>> Hi
>> My problem is thus: I am building a system of automated reports. No user
>> intervention is allowed. I am using Access 97 on NT 4.0. The people who
>> use these reports are on multiple platforms, so snapshot format is not
>> an answer. RTF loses formatting. I have Adobe Acrobat writer. It seems
>> that the only way to get Access reports to pdf is to make pdfwriter the
>> default printer and print to a pdf file. Not a problem. However, when
>> printing the report, a dialogue box appears to ask for a file name,
>> location, and press enter to save. Send keys is not an option, as with
>> the concurrence of processes in NT not all of the string sent may make
>> it to the dialogue box. Has anyone on the list solved something like
>> this with API calls? I am trying to figure this out myself, but am under
>> some time constraints. Any help would be appreciated.

>> Bob Press


> Hi all,

> I have a report that produces an invoice for a customer.  I have about
> 2000 customers.
> What I would like to do is something along the lines of:

> SQLString = "SELECT DISTINCT custNo FROM Customer"

> Set rs = db.OpenRecordset(SQLString)
> rs.MoveFirst

> While Not rs.EOF
>     [Print a report Called "CustomerReport" to a file named
> Rpt"&rs("CustNo")&".pdf"]
>     rs.MoveNext
> Wend

> If I use:

> DoCmd.SelectObject acReport, "Certificate", True
> DoCmd.PrintOut

> I get that darn dialog box that wants me to type in the filename.  I
> want to be able to avoid this dialog box and set the filename and move
> on to the next one.

> Any ideas?

> Thanks,
> Anna

> Anna Deak
> MDR Technologies Inc.
> (905) 829-3317 Ext. 109




Mon, 02 Sep 2002 03:00:00 GMT  
 Automating Reports Print to File in PDF format
Look under the Reports section of www.mvps.org/access.

 -- Dev


: Hi all,
:
: I have a report that produces an invoice for a customer.  I have about
: 2000 customers.
: What I would like to do is something along the lines of:
:
:
: SQLString = "SELECT DISTINCT custNo FROM Customer"
:
: Set rs = db.OpenRecordset(SQLString)
: rs.MoveFirst
:
: While Not rs.EOF
:     [Print a report Called "CustomerReport" to a file named
: Rpt"&rs("CustNo")&".pdf"]
:     rs.MoveNext
: Wend
:
: If I use:
:
: DoCmd.SelectObject acReport, "Certificate", True
: DoCmd.PrintOut
:
: I get that darn dialog box that wants me to type in the filename.  I
: want to be able to avoid this dialog box and set the filename and move
: on to the next one.
:
: Any ideas?
:
: Thanks,
: Anna
:
: Anna Deak
: MDR Technologies Inc.
: (905) 829-3317 Ext. 109

:



Mon, 02 Sep 2002 03:00:00 GMT  
 Automating Reports Print to File in PDF format
        Thanks guys!  It worked absolutely perfectly!

        Just one outstanding mystery...

        When I first ran my code, it opened Acrobat, and then opened
each PDF as it was generated, in Acrobat.  So if I need to run 2000
invoices, I would have 2000 documents open in Acrobat!  How to avoid
this? I tried dis-associating the PDF extension from Acrobat (and
screwed up Acrobat of course :)) So I got the disk and re-installed it.
But the weird thing is when I reinstalled Acrobat, and then re-ran the
code - the problem disappeared!  The pdf's are generated and Acrobat
never opens.

        Hmmm...  My problem is solved but I can't explain why and that
makes me nervous.  Any ideas?

        PS - I never had Acrobat on my PC till yesterday, so I think any
options in Acrobat were still in there "as installed" default state.

        Thanks,
        Anna



Tue, 03 Sep 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Automate Printing as PDF Files using VBA

2. Automating the printing of PDF files

3. Automate Report Output to PDF files

4. How to export a parameterized crystal report to pdf format file

5. not allowing viewers to print PDF and also to protect PDF files with password

6. Automate Printing to PDF

7. Automate printing to pdf??

8. Automating the Creation of PDF Files

9. How to print open email to Adobe Acrobat PDF format

10. Outputting Reports in .pdf format

11. Access 97 Report in pdf format.

12. reports in PDF format?

 

 
Powered by phpBB® Forum Software