Microsoft KB Archive/207681: Difference between revisions
m (Text replacement - ">" to ">") |
m (Text replacement - """ to """) |
||
Line 69: | Line 69: | ||
<li>On the '''View''' menu, click '''Design View'''.</li> | <li>On the '''View''' menu, click '''Design View'''.</li> | ||
<li>Click the '''Detail''' bar to select the detail section of the report. On the '''View''' menu, click '''Properties'''.</li> | <li>Click the '''Detail''' bar to select the detail section of the report. On the '''View''' menu, click '''Properties'''.</li> | ||
<li>Click the '''Format''' tab, and then change the '''Height''' property to '''0.75 | <li>Click the '''Format''' tab, and then change the '''Height''' property to '''0.75"'''.</li> | ||
<li>Add a text box to the detail section of the report below the existing fields, and set the following properties: | <li>Add a text box to the detail section of the report below the existing fields, and set the following properties: | ||
<div class="indent"> | <div class="indent"> | ||
Line 83: | Line 83: | ||
<p>Name: txtTextLabel<br /> | <p>Name: txtTextLabel<br /> | ||
Control Source: = | Control Source: ="Any text you want on your label"<br /> | ||
Top: .25 | Top: .25"<br /> | ||
Height: .45 | Height: .45"<br /> | ||
Visible: No<br /> | Visible: No<br /> | ||
Can Shrink: Yes<br /> | Can Shrink: Yes<br /> |
Latest revision as of 12:48, 21 July 2020
Article ID: 207681
Article Last Modified on 3/10/2003
APPLIES TO
- Microsoft Access 2000 Standard Edition
This article was previously published under Q207681
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
SUMMARY
This article describes how to display a label after a set number of printed lines of data on a report. For example, you can use this method to display a label after every third line of data in your report.
MORE INFORMATION
In order to display a label after every three lines in a report, follow these steps:
- Start Microsoft Access, and open the sample database Northwind.mdb or the sample project NorthwindCS.adp.
- In the Database window, click Reports under Objects, and then click New.
- In the New Report dialog box, click Report Wizard, select the Employees table from the list box indicating where the object's data comes from, and then click OK.
- Select one-by-one the EmployeeID, LastName, FirstName, and BirthDate fields from the Available Fields list by highlighting each field, and then clicking the > button. The selected fields will appear in the Selected Fields list.
- Click Finish.
- On the View menu, click Design View.
- Click the Detail bar to select the detail section of the report. On the View menu, click Properties.
- Click the Format tab, and then change the Height property to 0.75".
- Add a text box to the detail section of the report below the existing fields, and set the following properties:
Name: txtCounter
Control Source: =1
Running Sum: Over All
Visible: No - Add another text box to the detail section, and set the following properties:
Name: txtTextLabel
Control Source: ="Any text you want on your label"
Top: .25"
Height: .45"
Visible: No
Can Shrink: Yes
Can Grow: Yes - Select only the label attached to the txtTextLabel text box, and then press DELETE. This prevents the text box label from appearing with the text box.
- Click the Detail bar to select the detail section of the report.
- In the Properties box, click the Event tab.
- Right-click the On Format box, and then on the shortcut menu, click Build. In the Choose Builder dialog box, click Code Builder, and then click OK.
Type the following code:
Private Sub Detail_Format (Cancel As Integer, _ FormatCount As Integer) If ((Me![txtCounter]) Mod 3 = 0) Then Me![txtTextLabel].Visible = True Else Me![txtTextLabel].Visible = False End If End Sub
- On the File menu, click Close and Return to the Microsoft Access.
- On the File menu, click Print Preview. Note that the label appears after every third record.
REFERENCES
For additional information about formatting reports based on a set number of lines per group, click the article numbers below to view the articles in the Microsoft Knowledge Base:
208696 ACC2000: How to Print a Blank Line Every Nth Line in a Report
For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:
212536 OFF2000: How to Run Sample Code from Knowledge Base Articles
Additional query words: inf printing have appear insert inserting
Keywords: kbhowto KB207681