Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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).

↑ Back to the top


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.

↑ Back to the top


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.

  1. Open the sample database Northwind.mdb, and then create a new, blank report based on the Employees table.
  2. 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.
  3. Disassociate the labels from the text box controls. To do so, follow these steps:
    1. Select each label.
    2. Click Cut on the Edit menu.
    3. Select the report's Detail section.
    4. Click Paste on the Edit menu.
  4. Rename the label controls to FirstNameLabel, LastNameLabel, and TitleLabel.
  5. Place each of the labels directly on top of its corresponding text box control.
  6. Select all of the controls in the Detail section, and then move them to the far-left side of the Detail section.
  7. Set the report's Width property to 2".
  8. On the File menu, click Page Setup.
  9. In the Page Setup dialog box, click the Columns tab.
  10. Under Number of Columns, type 3.
  11. Click the Margins tab, and under Margins (inches) set Left to .5".
  12. Click the Page tab, and then under Orientation, click Landscape.
  13. Click the Columns tab, and then under Column Size, set Width to 2".
  14. Click OK to exit Page Setup.
  15. 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
    					
  16. 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.

↑ Back to the top


Keywords: KB208491, kbhowto

↑ Back to the top

Article Info
Article ID : 208491
Revision : 3
Created on : 6/23/2005
Published on : 6/23/2005
Exists online : False
Views : 296