I have the following code from Microsoft's site for skipping used labels when printing mailing labels.
Option Compare Database
Option Explicit
Dim intLabelBlanks As Integer
Dim intLabelCopies As Integer
Dim intBlankCount As Integer
Dim intCopyCount As Integer
'==========================================================
' The following function will cause an inputbox 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()
intLabelBlanks = Val(InputBox$("Enter Number of blank labels to skip"))
intLabelCopies = Val(InputBox$("Enter Number of Copies to Print"))
If intLabelBlanks < 0 Then intLabelBlanks = 0
If intLabelCopies < 1 Then intLabelCopies = 1
End Function
'===========================================================
' The following function sets the variables to a zero
'===========================================================
Function LabelInitialize()
intBlankCount = 0
intCopyCount = 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 intBlankCount < intLabelBlanks Then
R.NextRecord = False
R.PrintSection = False
intBlankCount = intBlankCount + 1
Else
If intCopyCount < (intLabelCopies - 1) Then
R.NextRecord = False
intCopyCount = intCopyCount + 1
Else
intCopyCount = 0
End If
End If
End Function
It worked great for a while.
But now, it doesn't seem to work anymore. I don't know what has changed. When I preview a report it previews with the skipped labels and the proper number of copies, but as soon as I print it, it loses the skipped labels part and starts at label 1. It does however print the number of copies I requested. I am using Access 2000 on Windows XP and NT machines. Same problem on both. Any ideas?
Melissa
Designing Access databases since 1999
Option Compare Database
Option Explicit
Dim intLabelBlanks As Integer
Dim intLabelCopies As Integer
Dim intBlankCount As Integer
Dim intCopyCount As Integer
'==========================================================
' The following function will cause an inputbox 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()
intLabelBlanks = Val(InputBox$("Enter Number of blank labels to skip"))
intLabelCopies = Val(InputBox$("Enter Number of Copies to Print"))
If intLabelBlanks < 0 Then intLabelBlanks = 0
If intLabelCopies < 1 Then intLabelCopies = 1
End Function
'===========================================================
' The following function sets the variables to a zero
'===========================================================
Function LabelInitialize()
intBlankCount = 0
intCopyCount = 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 intBlankCount < intLabelBlanks Then
R.NextRecord = False
R.PrintSection = False
intBlankCount = intBlankCount + 1
Else
If intCopyCount < (intLabelCopies - 1) Then
R.NextRecord = False
intCopyCount = intCopyCount + 1
Else
intCopyCount = 0
End If
End If
End Function
It worked great for a while.
But now, it doesn't seem to work anymore. I don't know what has changed. When I preview a report it previews with the skipped labels and the proper number of copies, but as soon as I print it, it loses the skipped labels part and starts at label 1. It does however print the number of copies I requested. I am using Access 2000 on Windows XP and NT machines. Same problem on both. Any ideas?
Melissa
Designing Access databases since 1999