Select Data and Include It in the Report
Recall that, in Part I, Create the New Report section, we bound our new
report object to the source query via the Choose The Table or Query where
the Object's Data comes from selector within the New Report
dialog, Design View (our selection of the query initialized the Report
Designer, from which we first saw the Header / Footer layout
in its basic, default form.) Our objective, at this step in our general
report-building procedure, is to select the desired data controls, objects that
represent the fields of the data source, and to include them by dragging the
selected controls into our report via the Report Design window.
Populating the Detail Section
First, let's summon the Field List that MS Access
provides as a "control palette" (my metaphor, not Microsoft's), so
that we can see the fields represented.
1.
Select View
--> Field List from the main menu in the Report
View.
2.
Select Field
List from the menu that appears.
The Field
List appears, as depicted in Illustration 8.
Illustration 8: The
Field List Appears
We can
now begin dragging controls, and thus the data fields they represent, into our
report. We will populate the Detail section, which, in our report,
represents the transactional level, first, and then handle the group headers
and footers next. (Our focus in this lesson is the inclusion and presentation
of the data. We will not spend a great deal of time on formatting, report
titles, and other such cosmetics, so as to allow maximum coverage of actual
reporting concepts.)
3.
In the Field
List, click the ProductID field.
4.
Hold down the CTRL
key, to allow the selections of non-contiguous fields.
5.
Click each of
the following to select them simultaneously with the ProductID field.
-
ProductName
-
UnitPrice
-
Quantity
-
Discount
-
NetOrder
The Field
List with selected fields appears as shown in Illustration 9.
Illustration 9: The
Field List with Our Selections
6.
Click some
point within the fields highlighted (left-mouse).
7.
Drag the
fields to the Detail section.
8.
Drop the
fields / controls at a point in the upper left corner of the Detail
section, at approximately zero (0) inches on the horizontal (across the top of
the Design View) ruler. Make the drop point as close to flush to the
top of the Detail section as possible
The
controls appear, still selected as a group, as shown in Illustration 10.
Illustration 10: Dropping
the Data Fields / Controls
At
this juncture, we will discuss working with the controls we have just put in
place. Actually, a pair of controls appears for each field we dragged
off the field list. The control to the left labels the control with
which it is paired (hence we refer to the control on the left as a label
control). The control to the right is known as a text control; it
is the actual representative of the underlying data field to which it is
attached, or "bound," in the data source.
To
move a control pair (actually termed a compound control), we select the
pair by clicking either control. Next, glide the mouse cursor over either of
the controls, until the cursor becomes a hand, as shown in Illustration 11.
Once the hand appears, simply click and drag to move the compound controls
together.
Illustration 11: Preparing
to Move the Compound Control
To
move only one of the two controls within the pair, drag it by its Move
handle, the large black box in the upper left corner of the control selected.
A hand with a pointing finger appears when the cursor is in position to move
the single control (as depicted in Illustration 12), at which point we
simply click and drag, to move the single control as required.
Illustration 12: Preparing
to Move the Single Control
The
smaller squares are Sizing handles for the selected control. Selection itself
is indicated by the appearance of Sizing handles: they are visible
only for the selected control. A summary diagram appears in Illustration 13.
Illustration 13: Summary
Diagram - Moving, Sizing and Selection for Controls