DrillMonkey
Technical User
Hi,
I'm using a form/sub form to print Shipping label(s) and a single report. The user fills in fields on the main/sub form including TotalParcels, the value in the "TotalParcels" is passed through code, and a corresponding number of shipping labels are printed including a single report "Delivery Memo" this is not working the way I expect. Sometimes it gives me the correct number of labels other times it more then I expect. I was hoping someone might see a problem in the code. The report seems to be ok..Thanks for your help.
I'm using a form/sub form to print Shipping label(s) and a single report. The user fills in fields on the main/sub form including TotalParcels, the value in the "TotalParcels" is passed through code, and a corresponding number of shipping labels are printed including a single report "Delivery Memo" this is not working the way I expect. Sometimes it gives me the correct number of labels other times it more then I expect. I was hoping someone might see a problem in the code. The report seems to be ok..Thanks for your help.
Code:
Private Sub Command11_Click()
Dim strWhere As String
Dim L As Long
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[MemoID] = " & Me.[MemoID] 'This code prints a report to default printer
DoCmd.OpenReport "rptMemo", acViewNormal, , strWhere
For L = 1 To Me!TotalParcels 'This code prints to optional Dymo Labelwriter
DoCmd.OpenReport "rptMemoDymo", acViewNormal, , strWhere
Next L
End If
End Sub