Hi
I'm using the Openreport method, and using a text box to control copies, how can I get the copy number to show on the printout for each page printed?
Private Sub cmdPrintLabel_Click()
Dim stDocName As String
stDocName = "rptShippingLabel2"
DoCmd.OpenReport stDocName, acViewPreview
DoCmd.PrintOut acSelection, , , acLow, Me.txtCopies
DoCmd.Close
End Sub
I need an event that fires everytime the page prints a copy... I thought ON print would work, but I don't see it firing everytime
The only issue with looping is that Access opens the print dialog box for each loop. This is only once when using ncopies via the print spooler.
Private Sub cmdPrintShipLabel_Click()
On Error GoTo Err_cmdPrintShipLabel_Click
Dim stDocName As String
Dim copy1 As Integer
copy1 = Me.txtCopies
For copy1 = 1 To Me.txtCopies
stDocName = "rptShippingLabel2"
DoCmd.OpenReport stDocName, acNormal, , , , copy1
Next copy1
Exit_cmdPrintShipLabel_Click:
Exit Sub
Err_cmdPrintShipLabel_Click:
MsgBox Err.Description
Resume Exit_cmdPrintShipLabel_Click
End Sub
Private Sub Report_Open(Cancel As Integer)
Dim strOpenArg As String
strOpenArg = Me.OpenArgs
Me.txtCopy = strOpenArg
End Sub
Public RptCopyNo As Integer
Dim stDocName As String
Dim I As Integer
stDocName = "rptShippingLabel2"
For I = 1 To Me.txtCopies
RptCopyNo = I
DoCmd.OpenReport stDocName, acNormal
Next
Private Sub Report_Open(Cancel As Integer)
Me.txtCopy = RptCopyNo
End Sub
Define a public variable in a standard module
[Then in the report
Code:Private Sub Report_Open(Cancel As Integer) Me.txtCopy = RptCopyNo End Sub
Is/Was me.TxtCopy a label? if so you should have said it like this
Me.TxtCopy.Caption = RptCopyNo