I have a table with the following information: item id, location,
cartons, units. With this table I created a report that will print
labels but I need labels for each carton. For each item I have a
different amount of cartons so I need to print a different amount
of labels. How can I use the cartons field to dictate how many
times the label is printed?
This will repeat print labels and offer the ability to start printing
from a pre-selected position on a sheet (if labels are missing).
First make a regular label report that correctly prints one label per
record.
It assumes a Report Record Source with a field [Qty] that contains the
number of times you wish to repeat a label.
Make sure the [Qty] field (or your equivalent field name) is included
in the Detail section.
Set it's Visible property to No.
Next add a Report Header to the report.
Add 2 unbound text boxes to the Header.
1) Name one SkipControl
Leave it's Control Source unbound
2) Name the other SkipCounter
Set it's Control Source to:
= [Skip How Many?]
Then code the Report Header Format event as follows:
(watch out for word wrap on the longer lines):
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
[SkipControl] = "Skip"
Cancel = True
End Sub
======
Next code the Detail Print event:
(Note that intMyPrint is Static!!)
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Static intMyPrint As Integer
If PrintCount <= [SkipCounter] And [SkipControl] = "Skip" Then
Me.NextRecord = False
Me.PrintSection = False
intMyPrint = 0
Else
[SkipControl] = "No"
Me.PrintSection = True
Me.NextRecord = True
intMyPrint = intMyPrint + 1
If intMyPrint Mod [Qty] = 0 Then
Me.NextRecord = True
intMyPrint = 0
Else
Me.NextRecord = False
End If
End If
End Sub
=========
When you run the report, it will ask how many missing label positions
to skip.
Then it will repeat labels as indicated in each records [Qty] field.
**Remember to change the [Qty] field to whatever you named your
field.**
Hope this helps.