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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Label _ of _ " on a report

Status
Not open for further replies.

fortage

MIS
Jun 15, 2000
329
US
How can I print on a report(label), the label number and total number of labels printed.<br>ie.&nbsp;&nbsp;Label 1 of 7<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Label 2 of 7<br><br>
 
Ok a couple of things<br>Create a function like so:<br>--------------------<br>Public Static Function LabelCounter() As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim Counter1 As Integer<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim db As Database, rst As Recordset, SQL As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Set db = CurrentDb<br>&nbsp;&nbsp;&nbsp;&nbsp;SQL = &quot;Select * from [yourTable] Where 'something equals the aount of labels'&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rst = db.OpenRecordset(SQL)<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.MoveLast<br>&nbsp;&nbsp;&nbsp;&nbsp;If RanOnce = True Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Counter1 = 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RanOnce = False<br>&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Counter1 = Counter1 + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;LabelCounter = &quot;Label &quot; & Counter1 & &quot; of &quot; & rst.RecordCount<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;db.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>End Function<br>--------------------------<br><br>2. Put the Variable &quot;RanOnce&quot; in the Declarations of the module like this:&nbsp;&nbsp;(under the other items listed there)<br>Global RanOnce<br><br>3. Add a Text box to your label and put this in its Control Source: =LabelCounter()<br>4. Put the&nbsp;&nbsp;RanOnce variable in the On_Activate Event of the report like this<br>Private Sub Report_Activate()<br>&nbsp;&nbsp;&nbsp;&nbsp;RanOnce = True<br>End Sub<br><br>5. you need to have an SQL statement that returns the same number of labels that are printed<br>Using Recordsetclone does not work for a report unfortunately.<br><br>OK have fun<br><br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
I don't think I gave you enough info.&nbsp;&nbsp;I'm trying to print one label multiple times, and have the LABEL * OF * printed on each identical label.<br><br>Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top