Anda di halaman 1dari 3

10 things you should know about working Version 1.

0
September 30, 2005
with Microsoft Access reports
When you need to share database information in a consistent and easy-to-read manner, you can use Access'
reporting features to present the relevant data in printed format. Setting up a report is a fairly straightforward
process, but knowing some of these tips and tricks will help you work more efficiently and generate better results.

1 Build a group header


If you group data numerically or alphabetically, you may want a visual clue that the group is changing. For
instance, you might want to print A, B, C, and so on, at the beginning of alphabetically grouped sections. In the
Group section, use a calculated control with the following expression as the controls Control Source property:
=Left(nameoffield, 1), where nameoffield is the field by which the section is grouped.

2 Create a no-hassle title page


If your report needs a title page, you dont have to create it separatelyuse the Report Header instead. Add the
text and graphics you want to appear in the title page to the Report Header section. Then, set the Report
Headers Force New Property to the After Section setting. That way, Access will force the data following the
Report Header to a new page. The report prints this section just once, so its a great spot for title page
information. Youll probably need to tweak the text and graphics in the Report Header section until you get things
arranged the way you want them, but thats a one-time job.

3 Enhance reports with chart summaries


Given the graphic nature of reports, charts are a great way to summarize the reported data. The good news is,
you can use the Chart Wizard to add a chart to a report. With the report in Design View, choose Chart from the
Insert menu and position the chart in the report. This will launch the Chart Wizard. Position the chart in the Report
Header or Footer or a Group Header or Footer to graphically summarize the data.

4 Omit unwanted extra pages


Sometimes, a report prints a blank page between each page or every other page. Usually, this blank page
indicates that the report is wider than the paper youve selected. Its easy to extend a control or line past the
margin and not even know itand its hard to find the offending object. An easy way to spot the problem is to click
the horizontal ruler at the right margin to select all of the controls that appear close to the margin. If youre lucky,
itll be just a few, and the one thats extending just a bit beyond that margin will be much easier to spot with the
selection handles showing. Once you find the object, simply adjust its size.

5 Print custom messages


Conditional formatting lets you base formats on the value itself. For instance, a negative value appears in red; a
positive value appears in black. Rather than formatting, you may want to print a particular message to yourself or
the reader. For instance, if a certain customer hasnt ordered for awhile, you may want a visual clue that reads
Call Customer for Chat. You can accomplish this by adding a text box (most likely in the Detail section) and
using an Iif() function in the form
Iif(conditionismet, "printthismessage")

Page 1
Copyright 2005 CNET Networks, Inc. All rights reserved.
For more downloads and a free TechRepublic membership, please visit http://techrepublic.com.com/2001-6240-0.html
0 things you should know about working with Microsoft Access reports

6 Save time with automatic formats


You can spend a lot of time formatting a report. Fortunately, if your specifications are consistent throughout the
same database, you dont need to reformat each one. Save your finished report as an AutoFormat and then apply
that AutoFormat to new reports.
First, with the finished report in Design View, choose AutoFormat from the Format menu. Then, click the
Customize button and check the Create A New AutoFormat Based On The Report Reportname' option and click
OK. Now, enter a name for the new AutoFormat and click OK. To apply the AutoFormat to a new report, choose
AutoFormat from the Format menu, select the custom item from the Reports AutoFormats list, and click OK.

7 Add line numbers


You can easily add a line number to detail records in a report. In Design View, add an unbound text box to the
Detail sectionusually to the left of the controls. Enter the expression =1 as the new controls Control Source
property. Then, change the controls Running Sum property to Over All for reports that arent grouped. If you want
numbering to be exclusive to a group, use the Over Group setting.

8 Use identifying expressions


Reports arent limited to the data in the data source. You might want to print the reports name or the location of
the database somewhere on your report. To do so, just add a calculated control, typically to the reports Header or
Footer section, and use one of the following expressions:
=CurrentObjectName prints the reports name
=CurrentDB.Name & & CurrentObjectName prints the reports complete pathname

9 Place a border around your report


You can display borders around controls and report sections, but theres no built-in feature that prints a border
around the perimeter of your report. To do that youll need to add the following code to the reports Page event:
Private Sub Report_Page()
Me.Line(0,0)-Me(Me.ScaleWidth, Me.ScaleHeight), , B
End Sub

10 Cancel an empty report


Just because you have a report, that doesnt mean it will include data. Sometimes, the criteria filter out all the
records and you end up with an empty report. Instead of viewing an empty report, you can cancel it by adding the
following VBA code to the reports No Data event:
Private Sub Report_NoData(Cancel As Integer)
MsgBox There are no records to display
Cancel = True
End Sub

Page 2
Copyright 2005 CNET Networks, Inc. All rights reserved.
For more downloads and a free TechRepublic membership, please visit http://techrepublic.com.com/2001-6240-0.html
0 things you should know about working with Microsoft Access reports

Additional resources
TechRepublic's Downloads RSS Feed
Sign up for our Downloads Weekly Update newsletter
Sign up for our Microsoft Office Suite newsletter
Check out all of TechRepublic's free newsletters
"70+ Keyboard shortcuts to move faster in Microsoft Access" (TechRepublic download)
"Creating cover pages for Access reports" (TechRepublic article)
"Use calculated fields in Access queries and reports" (TechRepublic article)
"Empower Access users: Teach them to use the Report Wizard" (TechRepublic article)

Version history
Version: 1.0
Published: September 30, 2005

Tell us what you think


TechRepublic downloads are designed to help you get your job done as painlessly and effectively as possible.
Because we're continually looking for ways to improve the usefulness of these tools, we need your feedback.
Please take a minute to drop us a line and tell us how well this download worked for you and offer your
suggestions for improvement.

Thanks!
The TechRepublic Downloads Team

Page 3
Copyright 2005 CNET Networks, Inc. All rights reserved.
For more downloads and a free TechRepublic membership, please visit http://techrepublic.com.com/2001-6240-0.html

Anda mungkin juga menyukai