Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2472
  • Last Modified:

Printing with vba code in MS ACCESS 2010 .. setting number of copies?

Im trying to print via vba code in ms access 2010.  I have the code in place using application.printer  It prints no problems and I can do a drop down box to select which printer to send it to.  I can change the page orientation, for some reason however I cannot get it to do copies.  I have provided my code below , been working on this for 3 days changing the code around and nothing seems to work.  Any help would be greatly appreciated.

this code does indeed change the orientation and print to printer, it wont however do the copies

DoCmd.OpenReport "checkin_blank", acViewPreview
Set rpt = reports("checkin_blank")
rpt.Printer = Application.Printers("hp2050")
    With reports("checkin_blank").Printer
        .Orientation = acPRORLandscape
        .Copies = 2
     End With
DoCmd.OpenReport "checkin_blank", acViewNormal
0
simichuck
Asked:
simichuck
  • 2
1 Solution
 
Nick67Commented:
<DoCmd.OpenReport "checkin_blank", acViewNormal >
This command all by itself tells Access to print a single copy, and is not needed

You need this
 
dim myCopies as integer
dim stdocname as string 
stdocname = "checkin_blank"
myCopies = 2

DoCmd.OpenReport stdocname, acViewPreview
Set rpt = reports(stdocname)
rpt.Printer = Application.Printers("hp2050")
With reports(stdocname).Printer
      .Orientation = acPRORLandscape
End With

With DoCmd
    .SelectObject acReport, stdocname, True
    .PrintOut acPrintAll, , , , myCopies
End With

Open in new window

0
 
simichuckAuthor Commented:
Exactly what I was looking for. Works perfect, thank you!
0
 
Nick67Commented:
You betcha!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now