Solved How to send a report to a color printer? (1 Viewer)

Sun_Force

Active member
Local time
Today, 21:34
Joined
Aug 29, 2020
Messages
396
I have a report that should be sent to different printers.
My question mainly is why the report is printed in black and white even when I send it to a color printer.

This is the code I use:

SQL:
Public Function PrintOrders()
    Dim rpt As string
    Dim fltr AS String
 
    rpt = "MyReport"
    fltr= "Order_PK IN (47407)"
    UseThisPrinter= "Canon iR-ADV C3520F LIPSLX"
 
    PrintReport rpt, fltr, UseThisPrinter
 
End Function

Public Function PrintReport(rpt As String, fltr As String, P as strPrinter )
  
    For Each prt In Application.Printers
        If strPrinter = prt.DeviceName Then
            GoTo SetPrinter
        End If
    Next
 
    SetPrinter:
    'Printer name is case sensitive - update name if case incorrect
    If StrComp(strPrinter, prt.DeviceName, vbBinaryCompare) <> 0 Then
        strPrinter = prt.DeviceName
    End If
    Application.Printer = Application.Printers(strPrinter)
    Set prt = Application.Printers(strPrinter)
 
    Reports(rpt).Printer = prt
    docmd.OpenReport rpt,acViewPreview,,fltr
 
End Function

This is the printer preferences:

2021-08-19_18-25-56.jpg



From report, if I select printer property, Black and White is selected.
From windows control panel if I open printer preferences, Color is selected.


Any kind of advice is appreciated.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:34
Joined
May 7, 2009
Messages
19,175
you can use

docmd.RunCommand acCmdPrint

to setup printer before the actual printing.
 

Sun_Force

Active member
Local time
Today, 21:34
Joined
Aug 29, 2020
Messages
396
you can use

docmd.RunCommand acCmdPrint

to setup printer before the actual printing.
I'm really sorry. But I don't understand what you mean. My question was why when I send a report to a color printer, it is still printed in black and white even if printer preferences in control panel is set to color mode as default.
Do you mean the method I chose to set the printer, affects on color mode of the printed page?
Where should I use your code?
Can you be a little bit more specific.

I appreciate your help.
 
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 20:34
Joined
May 7, 2009
Messages
19,175
i see.
i made changes to your PrintReport function so you need to pass True
to force Color printout:

PrintReport rpt, fltr, UseThisPrinter, True

Code:
Public Function PrintReport(ByVal rpt As String, ByVal fltr As String, ByVal strPrinter As String, Optional InColor As Boolean = False)
  Dim prt As Printer
    For Each prt In Application.Printers
        If strPrinter = prt.DeviceName Then
            GoTo SetPrinter
        End If
    Next
 
SetPrinter:
    'Printer name is case sensitive - update name if case incorrect
    If StrComp(strPrinter, prt.DeviceName, vbBinaryCompare) <> 0 Then
        strPrinter = prt.DeviceName
    End If
    Application.Printer = Application.Printers(strPrinter)
    Set prt = Application.Printers(strPrinter)
    If InColor Then
        prt.ColorMode = acPRCMColor
    Else
        prt.ColorMode = acPRCMMonochrome
    End If
 
    DoCmd.OpenReport rpt, acViewPreview, , fltr
    Set Reports(rpt).Printer = prt
 
End Function
 

Sun_Force

Active member
Local time
Today, 21:34
Joined
Aug 29, 2020
Messages
396
i see.
i made changes to your PrintReport function so you need to pass True
to force Color printout:

PrintReport rpt, fltr, UseThisPrinter, True

Code:
Public Function PrintReport(ByVal rpt As String, ByVal fltr As String, ByVal strPrinter As String, Optional InColor As Boolean = False)
  Dim prt As Printer
    For Each prt In Application.Printers
        If strPrinter = prt.DeviceName Then
            GoTo SetPrinter
        End If
    Next
 
SetPrinter:
    'Printer name is case sensitive - update name if case incorrect
    If StrComp(strPrinter, prt.DeviceName, vbBinaryCompare) <> 0 Then
        strPrinter = prt.DeviceName
    End If
    Application.Printer = Application.Printers(strPrinter)
    Set prt = Application.Printers(strPrinter)
    If InColor Then
        prt.ColorMode = acPRCMColor
    Else
        prt.ColorMode = acPRCMMonochrome
    End If
 
    DoCmd.OpenReport rpt, acViewPreview, , fltr
    Set Reports(rpt).Printer = prt
 
End Function

Sorry still the same. Report is printed in black and white.
 

Minty

AWF VIP
Local time
Today, 12:34
Joined
Jul 26, 2013
Messages
10,355
I think you can also set the printer preference properties from the access print dialog.
You probably need to do that and then it will "remember" the setting.

There are nearly always 2 places you need to set the printer properties. In windows and in the report setting.
If they are different for some reason (Sod's Law) Access will always use the wrong settings.
 

Sun_Force

Active member
Local time
Today, 21:34
Joined
Aug 29, 2020
Messages
396
I think you can also set the printer preference properties from the access print dialog.
You probably need to do that and then it will "remember" the setting.

There are nearly always 2 places you need to set the printer properties. In windows and in the report setting.
If they are different for some reason (Sod's Law) Access will always use the wrong settings.
that did the magic. Thank you.
 

isladogs

MVP / VIP
Local time
Today, 12:34
Joined
Jan 14, 2017
Messages
18,186
Only just noticed this thread one year on ...
To specify colour printing, try:
Application.Printer.acColorMode = 2 or the equivalent verbose version Application.Printer.acColorMode = acPRCMColor

Or if you want black & white, use
Application.Printer.acColorMode =1 or the equivalent Application.Printer.acColorMode = acPRCMMonochrome
 

Users who are viewing this thread

Top Bottom