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.
- 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 then move them to the far-left side of the Detail section.
- Set the report's Width property to 2".
- On the File menu, click Page Setup.
- In the Page Setup dialog box, click the Columns
tab.
- Under Number of Columns, type 3.
- Click the Margins tab, and under
Margins (inches) set Left to .5".
- Click the Page tab, and then under
Orientation, click Landscape.
- Click the Columns tab, and then under Column Size, set
Width to 2".
- Click OK to exit Page Setup.
- 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
- 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.