Microsoft KB Archive/148397

= ACC: How to Show Labels in Only the First Column of a Report =

Article ID: 148397

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition
 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q148397



Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
Microsoft Access repeats both text boxes and labels in the detail section when you set up a report to print multiple columns. This article describes a method that you can use to print just the labels in the first column and just the text boxes in subsequent columns.



MORE INFORMATION
The following steps show you how to create a three-column report with labels in only the first column. The example uses the Employees table in the sample database Northwind.mdb.

 Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0), and create a new, blank report based on the Employees table. If it is not displayed, open the Field List box, and add the FirstName, LastName, and Title fields to the detail section of the report.

NOTE: In version 2.0, type a space in the FirstName (First Name) and LastName (Last Name) fields. Disassociate the labels from the text box controls. To do so, follow these steps:

 Select each label. Click Cut on the Edit menu. Select the report's detail section.</li> Click Paste on the Edit menu.</li></ol> </li> Rename the label controls to [FirstNameLabel], [LastNameLabel], and [TitleLabel].</li> Place each of the labels directly on top of its corresponding text box control.</li> Select all of the controls in the detail section and move them to the far-left side of the detail section.</li> Set the report's Width property to 2".</li> In Microsoft Access 7.0 and 97, on the File menu, click Page Setup. In Microsoft Access 2.0, on the File menu, click Print Setup.</li> In Microsoft Access 97, in the Page Setup dialog box, click the Columns tab. In Microsoft Access 7.0, in the Page Setup dialog box, click the Layout tab. In Microsoft Access 2.0, in the Print Setup dialog box, click More.</li> In Microsoft Access 97, under Number of Columns, enter 3. In Microsoft Access 7.0 and 2.0, under Items Across, enter 3.</li> In Microsoft Access 7.0 and 97, click the Margins tab, and under Margins (inches) set Left to .5". In Microsoft Access 2.0, under Margins, set Left to .5".</li> In Microsoft Access 7.0 and 97, click the Page tab and under Orientation, click to select Landscape. In Microsoft Access 2.0, under Orientation, click to select Landscape.</li> In Microsoft Access 97, click the Columns tab and under Column Size set Width to 2". In Microsoft Access 7.0, click the Layout tab and under Item Size set Width to 2". In Microsoft Access 2.0, under Item size, set Width to 2".</li> Click OK to exit from Page or Print Setup.</li>  Set the report detail section's OnFormat property to the following event procedure.

<pre class="fixed_text">    ' NOTE: In version 2.0, for the following code, type a space for ' [First Name] and [Last Name].

If Me.Left < (2 * 1440) Then Me![FirstNameLabel].Visible = True Me![LastNameLabel].Visible = True Me![TitleLabel].Visible = True Me![FirstName].Visible = False Me![LastName].Visible = False Me![Title].Visible = False Me.NextRecord = False Else Me![FirstNameLabel].Visible = False Me![LastNameLabel].Visible = False Me![TitleLabel].Visible = False Me![FirstName].Visible = True Me![LastName].Visible = True Me![Title].Visible = True End If                       </li></ol>

Keywords: kbhowto KB148397

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.