You can modify many different properties on reportsto change how the report looks and performs. Like form properties,report properties are divided into categories: Format, Data, Event, andOther. To view a report’s properties, you first select the report,rather than a section of the report, in one of two ways:
After you have selected a report, you can view and modify its properties.
To select a report and open the Properties window atthe same time, you double-click the report selector. When you select areport, the Properties window appears, showing all the propertiesassociated with the report. A report has 77 properties available on theProperty Sheet (there are additional properties available only fromcode), broken down into the appropriate categories in the Propertieswindow. Fifty of the properties relate to the report’s Format, Data,and the properties on the Other tab; the remaining 27 relate to theevents that occur when a report is run. The Format, Data, and Otherproperties are described here.
Areport has the following 29 Format properties for changing the report’sphysical appearance. The text that follows explains many of the Formatproperties:
-
Caption
—
The
Caption
property of a report is the text that appears in the Report window’stitle bar when the user is previewing the report. You can modify it atruntime to customize it for a particular situation.
-
Default View
—
The
Default View
determines whether a report is opened in Report view or Print Preview.
-
Auto Resize
—
The
Auto Resize
property was introduced with Access 2002. Its setting determineswhether a report is resized automatically to display all the data onthe report.
-
Auto Center
—
You use the
Auto Center
property, which was introduced with Access 2002, to designate whetheryou want the Report window to automatically be centered on the screen.
-
Page Header
and
Page Footer
—
The
Page Header
and
Page Footer
properties determine on what pages the Page Header and Page Footersections appear. The options are All Pages, Not with Rpt Hdr, Not withRpt Ftr, and Not with Rpt Hdr/Ftr. You might not want the page headeror page footer to print on the report header or report footer pages,and these properties give you control over where those sections print.
-
Grp Keep Together
—
In Access, you can keep a group of data together on the same page by using the
Grp Keep Together
property. The Per Page setting forces the group of data to remain onthe same page, and the Per Column setting forces the group of data toremain within a column. A
group of data
refers to all the data within a report grouping (for example, all the customers in a city).
-
Border Style
—
The
Border Style
property was introduced with Access 2002. Like its form counterpart, itis far more powerful than its name implies. The options for the
Border Style
property are None, Thin, Sizable, and Dialog. If the
Border Style
property is set to None, the report has no border. If the
Border Style
property is set to Thin, the border is not resizable; the Size commandisn’t available in the Control menu. This setting is a good choice forpop-up reports, which remain on top even when other forms or reportsare given the focus. Having the
Border Style
property set toSizable is standard for most reports. It includes all the standardoptions in the Control menu. The Dialog setting creates a border thatlooks like the border created by the Thin setting. The user can’tmaximize, minimize, or resize a report with the
Border Style
property set to Dialog. After you set the
Border Style
property of a report to Dialog, the Maximize, Minimize, and Resize options aren’t available in the report’s Control menu.
-
Moveable
—
The
Moveable
property determines whether the user can move the Report window aroundthe screen by clicking and dragging the report by its title bar.
A report has the following six Data properties, which are used to supply information about the data underlying a report:
A report has 15 Other properties (see
Figure 2
);these miscellaneous properties, some of which are described in thefollowing text, enable you to control other important aspects of areport:
Basing Reports on Stored Queries or Embedded SQL Statements
Basing Access reports on stored queries offers two major benefits:
In earlier version of Access, reports based on
stored queries open faster than reports based on embedded SQL
statements. This is because when you build and save a query, Access
compiles and creates a query plan. This query plan is a plan of
execution that’s based on the amount of data in the query’s tables as
well as all the indexes available in each table. In early versions of
Access, if you ran a report based on an embedded SQL statement, the
query was compiled, and the query plan was built at runtime, slowing
the query’s execution. With Access 2010, query plans are built for
embedded SQL statements when a form or report is saved. Query plans are
stored with the associated form or report.
So what are the benefits of basing a report on a
stored query instead of an embedded SQL statement? You may want to
build several reports and forms, all based on the same information. An
embedded SQL statement can’t be shared by multiple database objects. At
the very least, you must copy the embedded SQL statement for each form
and report you build. Basing reports and forms on stored queries
eliminates this problem. You build the query once and then modify it if
changes need to be made to it. Many forms and reports can all use the
same query (including its criteria, expressions, and so on).
It’s easy to save an embedded SQL statement as a
query, and doing so allows you to use the Report Wizard to build a
report using several tables. You can then save the resulting SQL
statement as a query. With the report open in Design view, you bring up the Properties window. After you select the Data tab, click in the Record Source
property and click the ellipsis (...). The embedded SQL statement
appears as a query. You need to select Save Object As from the File
tab, enter a name for the query, and click OK. Then you close the Query
window, indicating that you want to update the Record Source property. The query is then based on a stored query instead of an embedded SQL statement.
|
Reports often contain complex expressions. If a
particular expression is used in only one report, nothing is lost by
building the expression into an embedded SQL statement. On the other
hand, many complex expressions are used in multiple reports and forms.
If you build these expressions into queries on which the reports and
forms are based, you have to create each expression only one time.
Although basing reports on stored queries offers
several benefits, it also has downsides. For example, if a database
contains numerous reports, the database container becomes cluttered
with a large number of queries that underlie those reports.
Furthermore, queries and the expressions within them are often very
specific to a particular report. If that is the case, you should opt to
use embedded SQL statements rather than stored queries. As a general
rule, if several reports are based on the same data and the same
complex calculations, you should base them on a stored query. If a
report is based on a unique query with a unique set of data and unique
calculations, you should base it on an embedded SQL statement.