Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Module for Printing Multiple or Unique Label with Full or Partly Used Sheets?

1 view
Skip to first unread message

Telesphore

unread,
Apr 21, 2010, 10:16:57 AM4/21/10
to
The following code is very fine for MULTIPLE labels, could it be possible to
fix it that it could be used for only ONE label ?

Thank you.


http://support.microsoft.com/kb/95806
ACC: How to Skip Used Mailing Labels and Print Duplicates

Create a new module, and place the following lines in the Declarations
section:
'*********************************************************
'Declarations section of the module.
'**********************************************************
Option Compare Database
Option Explicit
Dim LabelBlanks&
Dim LabelCopies&
Dim BlankCount&
Dim CopyCount&
'==========================================================
' The following function will cause an input box to
' display when the report is run that prompts the user
' for the number of used labels to skip and how many
' copies of each label should be printed.
'===========================================================
Function LabelSetup ()
LabelBlanks& = Val(InputBox$("Enter Number of blank labels to skip"))
LabelCopies& = Val(InputBox$("Enter Number of Copies to Print"))
If LabelBlanks& < 0 Then LabelBlanks& = 0
If LabelCopies& < 1 Then LabelCopies& = 1
End Function
'===========================================================
' The following function sets the variables to a zero
'===========================================================
Function LabelInitialize ()
BlankCount& = 0
CopyCount& = 0
End Function
'===========================================================
' The following function is the main part of this code
' that allows the labels to print as the user desires.
'===========================================================
Function LabelLayout (R As Report)
If BlankCount& < LabelBlanks& Then
R.NextRecord = False
R.PrintSection = False
BlankCount& = BlankCount& + 1
Else
If CopyCount& < (LabelCopies& - 1) Then
R.NextRecord = False
CopyCount& = CopyCount& + 1
Else
CopyCount& = 0
End If
End If
End Function

Open the report named MyLabels in Design view and add the following line to
the OnPrint property of the Detail section:
=LabelLayout(Reports![MyLabels])

Add the following line to the OnOpen property of the MyLabels Report:
=LabelSetup()

Although typically labels do not have a report header, add a Report Header
and Footer to the re-port by selecting Report Header/Footer from the View
menu (or Format menu in version 2.0 or Layout menu in version 1.x). Then,
add the following line to the OnFormat property of the report header:
=LabelInitialize()

1. Set the Height property for both the report header and report footer to
0.

0 new messages