Microsoft KB Archive/208491

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

Article ID: 208491

Article Last Modified on 6/23/2005

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q208491



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
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 only the labels in the first column and only 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.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

 Open the sample database Northwind.mdb, and then create a new, blank report based on the Employees table. If it is not displayed, open the Field List box, and then add the FirstName, LastName, and Title fields to the Detail section of the report. 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 then move them to the far-left side of the Detail section.</li> Set the report's Width property to 2".</li> On the File menu, click Page Setup.</li> In the Page Setup dialog box, click the Columns tab.</li> Under Number of Columns, type 3 .</li> Click the Margins tab, and under Margins (inches) set Left to .5".</li> Click the Page tab, and then under Orientation, click Landscape.</li> Click the Columns tab, and then under Column Size, set Width to 2".</li> Click OK to exit Page Setup.</li>  Set the report's Detail section's OnFormat property to the following event procedure: 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> On the View menu, click Print Preview.

Note that the labels appear in the leftmost column, while the data appears in the columns to the right of the first column.</li></ol>

Keywords: kbhowto KB208491

-

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

© Microsoft Corporation. All rights reserved.