Skip labels code

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi Guys.
I have recently downloaded the sample reports file from
the MS website. I then opened up an example report
allowing the user to skip labels when printing records (ie
if I have already printed on 5 labels and want to start on
the 6th.)

After selecting to skip labels, the preview of the report
SHOWS that there are 5 labels that are going to be
skipped. HOWEVER, when I go to print, there are NO labels
skipped at all.

Please help as we need this code for printing on labels
for food box distribution for Xmas...

Peter
 
Peter said:
Hi Guys.
I have recently downloaded the sample reports file from
the MS website. I then opened up an example report
allowing the user to skip labels when printing records (ie
if I have already printed on 5 labels and want to start on
the 6th.)

After selecting to skip labels, the preview of the report
SHOWS that there are 5 labels that are going to be
skipped. HOWEVER, when I go to print, there are NO labels
skipped at all.

Please help as we need this code for printing on labels
for food box distribution for Xmas...

Peter

Here is my code to skip labels.

First make sure your label report is properly printing a full sheet of
labels.

Then add a Report Header to your label report.
Add 2 text boxes to the Header.
1) Name one SkipControl
Leave it's control source unbound

2) Name the other SkipCounter
Set it control Source to =[Skip How Many?]

Now code the Report Header Format event as below:

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
[SkipControl] = "Skip"
Cancel = True
End Sub
==========

Next code the Detail OnPrint event:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
If PrintCount <= [SkipCounter] And [SkipControl] = "Skip" Then
Me.NextRecord = False
Me.PrintSection = False
Else
[SkipControl] = "No"
Me.PrintSection = True
Me.NextRecord = True
End If

End Sub
=====

When you are ready to run the label report, it will ask how many to
skip.
Then it will run the report.
 
Back
Top