Article ID: 148397 - Last Review: January 19, 2007 - Revision: 2.1 ACC: How to Show Labels in Only the First Column of a ReportThis article was previously published under Q148397
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.
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.
- Click Paste on the Edit menu.
- Rename the label controls to [FirstNameLabel], [LastNameLabel], and
[TitleLabel].
- Place each of the labels directly on top of its corresponding text box
control.
- Select all of the controls in the detail section and move them to the
far-left side of the detail section.
- Set the report's Width property to 2".
- 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.
- 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.
- In Microsoft Access 97, under Number of Columns, enter 3. In Microsoft
Access 7.0 and 2.0, under Items Across, enter 3.
- 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".
- 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.
- 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".
- Click OK to exit from Page or Print Setup.
- 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
APPLIES TO- Microsoft Access 2.0 Standard Edition
- Microsoft Access 95 Standard Edition
- Microsoft Access 97 Standard Edition
Retired KB Content DisclaimerThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated. | |