Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Docmd.PrintOut only prints in black and white 2

Status
Not open for further replies.

ezwebmaster

IS-IT--Management
Mar 6, 2008
4
US
Hello all,

I have a rather strange problem using Visual Basic to print out images in MS Access 2003. I have a form which displays a large image. There are two buttons at the bottom (Print in BW and Print in Color). The user clicks the Color button to print to our KODAK 5500 AIO color printer. The code for this routine is:

Code:
Private Sub color_Click()
    Dim strDefaultPrinter As String
    strDefaultPrinter = Application.Printer.DeviceName
    ' switch to our color printer:
    Set Application.Printer = Application.Printers("KODAK 5500 AiO")
    DoCmd.PrintOut , , , , 1, True
    'switch back to the default printer
    Set Application.Printer = Application.Printers(strDefaultPrinter)
End Sub
We used to have a different color printer, and it worked fine. But now that we've switched to our Kodak one, the PrintOut method only prints in black and white.

The really strange thing is that you can hit the Print button under File/Print on the MS Access toolbar and it DOES print in color. So the PrintOut method itself seems to be the problem.

I have tried inserting the following code:

Application.Printer.ColorMode = acPRCMColor

but it seems to have no effect. Is there another way to force PrintOut to use color instead of bw? Maybe it is a driver problem?

Any guidance you can give me is much appreciated!
 
Have you tried using excel and recording a macro when you select b&w printing and then print selecting color look at the code and modify if needed and use in access.

ck1999
 
The excel code prints in color without a problem. The issue seems limited to Access alone. I have sent Kodak an email concerning the problem.
 
Alright.

For no reason that I can discern, the code:

Application.Printer.ColorMode = acPRCMColor

now works, allowing me to print in color to my Kodak 5500 AiO. As mentioned earlier, I used that exact syntax before and the printer still printed only in black-and-white using DoCmd.PrintOut.

The only change I've made is updating the firmware for the Kodak printer earlier today. The update description said it had fixed some bugs in printing-perhaps this is one of them.


 
Actually the key is:

Printer.ColorMode = acPRCMColor

this resets the ColorMode to always print out in color if it can.

Application.Printer.ColorMode = acPRCMColor doesn't seem to do anything at all.
 
I'm using the CutePDF driver and was having exactly the same problem. If I previewed the report and then choose the CutePDF driver it would print in color but if I printed directly it would only print B&W.

Got around it by using approach below - example does not include any error checking etc.:

Dim strTempPrinter As String
Dim strcurrentPtr As String
strCurrentPtr = Application.Printer.DeviceName 'Gets default printer and assigns to strcurrentptr
strTempPrinter = DLookup("PDFPrinter", "tblLocalPath", "id=1") ‘Looks up name of local PDF driver from local User table
Set Application.Printer = Application.Printers(strTempPrinter) 'Switches default printer to PDF driver
DoCmd.OpenReport "rptInvoice", acPreview ‘ Open report in Preview mode
With Reports("rptInvoice").Printer
.ColorMode = acPRCMColor 'Sets color mode
End With
DoCmd.PrintOut 'Prints using current settings
DoCmd.Close acReport, "rptInvoice", acSaveYes 'Closes report that was previewed
Set Application.Printer = Application.Printers(strcurrentPtr) 'Sets printer driver back to original default printer

Printer.ColorMode = acPRCMColor nor Application.Printer.ColorMode = acPRCMColor worked for me!!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top