2 labels

BillBee

Registered User.
Local time
, 17:02
Joined
Aug 31, 2008
Messages
137
I am working from a table which contains amongst other data, a number field (usually numbers are 1 or 2 but could occasionally be more). I have created a label but I would like to print labels to match the number in the Number field. E.G. 1 in the number field 1 label or 2 in the number field 2 labels. Is this possible if so can anyone help. Thanks.
 
Run the report in Print Preview.

Take a look at the attached. Look at the VBA code for the report.

Sorry don't have time to explain just now.
 

Attachments

So, more time now. The code for the report looks like this:

Code:
Dim LabelCount As Integer

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If LabelCount = Me.qty Then
        LabelCount = 1
        Me.NextRecord = True
    Else
        LabelCount = LabelCount + 1
        Me.NextRecord = False
    End If
End Sub

Private Sub Report_Open(Cancel As Integer)
    LabelCount = 1
End Sub

What's happening is that the On Format event for the label is incrementing LabelCount if the label quantity (me.qty) has not been reached and also setting NextRecord to false so that the next time Detail is run it prints the same record again. Me.qty is a field on the report - it's hidden so that it doesn't appear on the label.

hth
Chris
 
My data for this report is coming from a query on the report. I wondered if this is the problem. Thought I had written code in correctly. Cannot open report, receiving message -------following error: Member already exists in an Object Module from which this Object Module derives. Have attached a file
 

Attachments

You have used the word "NumberAttending" as a variable name. But this is also the name of one of your fields. So Access is not happy.

Change the name of the variable to something like LabelCount like this:

Code:
Dim LabelCount As Integer

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    If LabelCount = Me.Number Then
       LabelCount = 1
       Me.NextRecord = True
    Else
       LabelCount = LabelCount + 1
       Me.NextRecord = False
    End If
    
End Sub

Private Sub Report_Open(Cancel As Integer)
    LabelCount = 1

End Sub
 

Users who are viewing this thread

Back
Top Bottom