Still get errors.
My Module looks like:
'*********************************************************
'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
My report Looks like:
Option Compare Database
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
=LabelLayout (Reports![MyLabels])
End Sub
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)
=LabelInitialize()
End Sub
Private Sub Report_Open(Cancel As Integer)
=LabelInitialize
End Sub
Brendan Reynolds said:
Probably, when you copied and pasted the code, you missed the first
comment
character, i.e. the first line in your module begins with a * instead of
a '
--
Brendan Reynolds
Access MVP
Bob B said:
I get compile errors when trying to implement the "How to skip Used
Mailing
Labels"
Article ID: 95806
On Print Property of label "MYLabels"
=LabelLayout(Reports![MyLabels])
Error is Expecting line number,or label or statement.
also
OnOpen property
=LabelSetup()
On Format property of Header
=LabelInitialize()