Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skipping Labels

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hi

I posted this in the "other" section on error - sorry for the duplication.

I have code (and unfortunately it was provided by another site and I'm not sure of the author), which prompts the user to be able to skip labels at run time. The code is as follows:

Option Compare Database
Option Explicit

Dim LabelBlanks&
Dim LabelCopies&
Dim BlankCount&
Dim CopyCount&

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

Function LabelInitialize()
BlankCount& = 0
CopyCount& = 0
End Function

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

For the report, LabelSetup() is placed in the OnOpen event of the report, LabelInitialize() is placed in the OnFormat event of the ReportHeader and LabelLayout([Reports]![ReportName]) is placed in the OnPrint Event of the Details section. This works great.

However, I have created a receipt report which uses the format of nametag inserts supplied by Avery to print on. Because it involves summary calculations, the report is created using a groupheader with the details section suppressed. Placing the LabelLayout([Reports]![ReportName]) in the GroupHeader instead of the details section doesn't work and the skip labels is ignored if left in the details section.

What do I need to do to have these functions work? Look forward to your replies!

Shelby
 
HI

I figured it out! I added R.MoveLayout = True to the LabelLayout function, put the function in the header format and voila - it works!

Thanks anyway!

Shelby
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top