Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 208491 - Last Review: June 23, 2005 - Revision: 3.0
ACC2000: How to Show Only Labels in the First Column of a Report
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).
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.
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.
APPLIES TO
- Microsoft Access 2000 Standard Edition
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate