Hi
I have created a report for labels using the Label Wizard, and found the code on the MS KB about skipping the labels that have already been used, and printing on the next one along.
Page on MS KB
When I try using this code in Access 2003 however, it seems to go into some sort of loop, and produces 100+ pages for the report when I try and skip 1 label for example.
Can anyone help me get this working for 2003?
Here's my module code, same as on the site above:
Thanks
I have created a report for labels using the Label Wizard, and found the code on the MS KB about skipping the labels that have already been used, and printing on the next one along.
Page on MS KB
When I try using this code in Access 2003 however, it seems to go into some sort of loop, and produces 100+ pages for the report when I try and skip 1 label for example.
Can anyone help me get this working for 2003?
Here's my module code, same as on the site above:
Code:
'*********************************************************
'Declarations section of the module.
'*********************************************************
Option Compare Database
Option Explicit
Dim LabelBlanks&
Dim LabelCopies&
Dim BlankCount&
DimCopyCount&
'=========================================================
' 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 used 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
Thanks