print on specific printer in code

  • Thread starter geert.van.ransbeeck
  • Start date
G

geert.van.ransbeeck

Hello

I want to send my report to a specific printer. I want to do it by
code.
Here is what I have. Just how make my printerselection?
Thanks in advance!


Dim inum As Integer
Dim sRapport As String

sRapport = "RPT_RADI1"
DoCmd.OpenReport sRapport, acViewPreview, , , acHidden

inum = Val(InputBox("how many prints?", "Print Report", 1))
If iAantal > 0 Then
DoCmd.SelectObject acReport, sRapport
DoCmd.PrintOut , , , , iAantal
End If
DoCmd.Close acReport, sRapport
 
A

Albert D. Kallal

You dont mention what version of ms-access.

In access 2002 and later, there is a built in printer object, and it lets
you switch the printer with ease.

You can use:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

So, to save/switch, you can use:

dim strDefaultPrinter as string

get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever..print...

Now Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)
 
G

geert.van.ransbeeck

I am on a network so in
Set Application.Printer = Application.Printers("HP LaserJet Series
II")
I changed "HP LaserJet Series II" into the name BRANUUIUYGBK, the
printername as he is mentioned.
Is this correct?
I've got invalid procedure all or argument as error message.
 

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