The information in this article applies to:
- Microsoft Access versions 2.0, 7.0
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 how to create a three-column report with labels
in only the first column, using 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, there is a space in the First Name and Last Name
fields.
- Disassociate the labels from the text box controls. To do so, follow
these steps:
a. Select each label.
b. Click Cut on the Edit menu.
c. Select the report's detail section.
d. 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, on the File menu, click Page Setup.
In Microsoft Access 2.0, on the File menu, click Print Setup.
- 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.
- Under Items Across, enter 3.
- In Microsoft Access 7.0, 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, 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 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 in [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
|