Number of copies

  • Thread starter Thread starter Mark Anders
  • Start date Start date
M

Mark Anders

Hi!

How to define number of copies on printig. My code is:

Private Sub PrintInv()
Dim strDocName As String
Dim strWhere As String
strDocName = "Invoice"
strWhere = "OrderNr=" & Me!OrderNr
DoCmd.OpenReport strDocName, acViewNormal, , strWhere, acHidden, 2
End Sub

This procedure prints only 1 copy instead of 2. How I should change code to
get 2 copies?
 
Hi!

How to define number of copies on printig. My code is:

Private Sub PrintInv()
Dim strDocName As String
Dim strWhere As String
strDocName = "Invoice"
strWhere = "OrderNr=" & Me!OrderNr
DoCmd.OpenReport strDocName, acViewNormal, , strWhere, acHidden, 2
End Sub

This procedure prints only 1 copy instead of 2. How I should change code to
get 2 copies?

You can't simply throw a number out(2) and expect Access to know what
to do with it.
The syntax for the OpenReport method is shown in VBA help files. It
does not include an argument to print out x number of copies.
Look up the SelectObject and and the PrintOut methods in VBA help.

Try...

Private Sub PrintInv()
Dim strDocName As String
Dim strWhere As String
strDocName = "Invoice"
strWhere = "OrderNr=" & Me!OrderNr
DoCmd.OpenReport strDocName, acViewPreview , , strWhere
DoCmd.SelectObject acReport, strDocName, False
DoCmd.PrintOut acPrintAll , , , , 2
End Sub
 
hi Mark,

here is one way:

make the following table:

Numbers
- Num, integer

and fill it with records 1-31 (so it is useful for other reasons, like
getting a specific day of a month)

then, in the RecordSource for Invoice, add the Numbers table (no
relationship line) and put Num on the grid

then, modify strWhere to this:
strWhere = "OrderNr=" & Me!OrderNr & " AND Num=2"

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

*
(: have an awesome day :)
*
 
Back
Top