Solved

MS Access Report Won't Print to PDF File in Colour

Posted on 2010-08-25
9
1,109 Views
Last Modified: 2013-11-28

I'm using Access 2003 and Windows 7.  I have Acrobat installed as a printer.
I use the VBA code below to print a report to a pdf but the resulting pdf file is always in black and white even though I use colour fonts in my report.  I've set all my Acrobat options to colour manually wherever I can.

Set Application.printer = "Adobe PDF"
Crit$ = "[Invoice_no]= " & Val(frmS![ListBoxInvoice])
DoCmd.OpenReport "rpt_invoice", acNormal, , Crit$

I tried adding Application.printer.ColorMode = acPRCMColor after selecting the printer but still get a black and white PDF only.
If I open my report manually, select the print menu, select 'Adobe PDF' as the printer and print, the resulting pdf is in colour.

I've tried the solution in http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_21597698.html but it doesn't solve my problem.

I get the problem on two different PCs so don't think the problem lies with any corrupt installations.

Can anyone help?  Thanks.




0
Comment
Question by:Supertension
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 33528638
Have a look at http:Q_20878116.html

Gary
0
 
LVL 57
ID: 33530429
Just to add to Gary's comment a bit (no points please), here's a screen shot of what your looking for.
JimD.

Region-Capture.bmp
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33532607
<No Points wanted>
If you open the report in *Print Preview*, is it in color or b/w?

This is sometimes a good indication of the printer color settings.

;-)

JeffCoachman
0
 

Author Comment

by:Supertension
ID: 33535205
Thanks guys, I've checked the Adobe color property suggested by Gary and JimD and it's set to color ok.

I've checked "Print Preview" as suggested by JeffCoachman and it's in color OK.  If I preview the report, right click, select Print.... then go on to print to a pdf using Adobe, I get a color pdf.  The problem only occurs when I use VBA to automate the pdf creation.

David
 
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33536836
The code you posted:

Set Application.printer = "Adobe PDF"
Crit$ = "[Invoice_no]= " & Val(frmS![ListBoxInvoice])
DoCmd.OpenReport "rpt_invoice", acNormal, , Crit$

1. Where are you declaring: Crit$ ?
2. AFAICT this code prints an MS Access"Report" to the adobe printer.
It does not explicitly print a specific Adobe PDF document.  To do this, it would seem to need a filename.

But remember, a PDF is basically a stored collection of printer commands (for lack of a better explanation) that it sends to the printer

So printing the Report or printing a PDF (of the same report) will/should result in the exact same output.

For example: if someone handed a hardcopy printout, how would you know if it was a PDF, or an Access Report, or a WordDoc?
;-)


So what happens when you just print the (MS Access) Report?

If that prints in color, then just print the Report.
Then just use the PDF for emailing, distribution, ...etc

;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 33536869
Clarification:

Change this:
So what happens when you just print the (MS Access) Report?

...to this:

So what happens when you just print the (MS Access) Report to the color printer (not the Adobe Printer), with the correct color settings?

If that prints in color, then just print the Report.
Then just use the PDF for emailing, distribution, ...etc

;-)

JeffCoachman
0
 

Author Comment

by:Supertension
ID: 33539222
I don't think the Crit$ declaration has any effect.  I've just created a simple database from scratch with a single report in it and I now use

Set Application.printer = "Adobe PDF"
DoCmd.OpenReport "Report1", acNormal
 
I still get the same problem.

The code prints an Access report called Report1 to the Adobe PDF printer.  The Adobe PDF printer is set to save the file on my desktop.  The file name is produced automatically - it is either the Report1 caption or, if I've left the caption property blank, the file  name is Report1.pdf.

Printing the report straight to a color printer works OK.
Printing the report to the "Adobe PDF" printer manually (i.e.  not using VBA) works.
I only get the problem when I use VBA to do the printing.

I really need to get it working via VBA as later on in my code I combine several different PDFs from different sources into a single pdf for sending to my customer.  Everything must be in color.  Thankfully, this part of my code works OK.

David

0
 

Accepted Solution

by:
Supertension earned 0 total points
ID: 33539373
Just managed to solve the problem.

I went to the page setup for the report, selected 'Use Specific Printer' and selected 'Adobe PDF'.

I then simplified my VBA to DoCmd.OpenReport "Report1", acNormal and it now prints to a pdf in perfect color.

Many thanks for eveyone's help.

David
AdobeSolved.PNG
0
 
LVL 57
ID: 33541135
<<I went to the page setup for the report, selected 'Use Specific Printer' and selected 'Adobe PDF'.>>
 Agh... I thought they had  changed that by 2003.  In past versions, if you choose "Default printer", you'd end up with the printer settings in windows, not the one's in your report.
 Choosing specific printer forced Access to save the printer settings along with the report.
 Good sleuthing on your part.  Make sure you accept your own comment as answer.
JimD.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The ability to edit PDF documents can be useful, however it may not be a straight forward process. Many non-technical people don't realise that a PDF document is basically an image rather than a text file, even if it contains nothing but text. If…
Have you ever come up with a need of emailing only few pages of PDF file to one of yourfriend or colleague, instead of whole Adobe file? If yes, then surely you have face problems in doing that! Read this section as I have suggested multiple solutio…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now