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
simichuckAsked:
Who is Participating?
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.