Printing to PDF in Access 2007 and using a where statement

G

Guest

Before I moved to Access 2007 and Vista I was using Open Source software
called PDFCreator which enabled me to print to PDF. This software does not
work in Vista so I am stuck with using the PDF approach recently implemented
as an add on in Office.

I have noted that this will work in printing to PDF.

DoCmd.OutputTo acOutputReport, "CharacterReport", acFormatPDF, strFile, True

However my issue is that I normally use a button to print as follows:

DoCmd.OpenReport "CharacterReport", acViewNormal, , "[Character
Database].[ID] = " & CharacterT

As I can see no way of including the WHERE statement I was wondering if it
is possible to make the PDF printer the default printer, but realised that
the PDF solution in Office is not a printer as such.

Has anyone got any method or ideas how to do this, or should I seek out a
third party and hopefully free solution like PDFCreator?
 
A

Allen Browne

If you open the report in preview mode first, and then use OutputTo, the
output report will be filtered the way the preview is.
 
G

Guest

Allen,

Thanks very much for that, it works perfectly:

DoCmd.OpenReport "CharacterReport", acViewPreview, , "[Character
Database].[ID] = " & CharacterT
DoCmd.OutputTo acOutputReport, "CharacterReport", acFormatPDF, "z:\turns\PDF
Files\CharacterReport.pdf", False
DoCmd.Close acReport, "CharacterReport", acSaveNo

Thanks for your help, much appreciated

David

Allen Browne said:
If you open the report in preview mode first, and then use OutputTo, the
output report will be filtered the way the preview is.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Totally-PBM said:
Before I moved to Access 2007 and Vista I was using Open Source software
called PDFCreator which enabled me to print to PDF. This software does
not
work in Vista so I am stuck with using the PDF approach recently
implemented
as an add on in Office.

I have noted that this will work in printing to PDF.

DoCmd.OutputTo acOutputReport, "CharacterReport", acFormatPDF, strFile,
True

However my issue is that I normally use a button to print as follows:

DoCmd.OpenReport "CharacterReport", acViewNormal, , "[Character
Database].[ID] = " & CharacterT

As I can see no way of including the WHERE statement I was wondering if it
is possible to make the PDF printer the default printer, but realised that
the PDF solution in Office is not a printer as such.

Has anyone got any method or ideas how to do this, or should I seek out a
third party and hopefully free solution like PDFCreator?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top