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

ID: Q148397


The information in this article applies to:
  • Microsoft Access versions 2.0, 7.0, 97


SUMMARY

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

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.

  1. Open the sample database Northwind.mdb (or NWIND.MDB in version 2.0), and create a new, blank report based on the Employees table.


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


  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 move them to the far-left side of the detail section.


  7. Set the report's Width property to 2".


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


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


  10. In Microsoft Access 97, under Number of Columns, enter 3. In Microsoft Access 7.0 and 2.0, under Items Across, enter 3.


  11. 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".


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


  13. 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".


  14. Click OK to exit from Page or Print Setup.


  15. Set the report detail section's OnFormat property to the following event procedure.
    
         ' 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 


Keywords : RptLayou
Version : 2.0 7.0 97
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: April 30, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.