Microsoft Office Tutorials and References
In Depth Information
The subform’s Detail section contains the tblInvoice table fields. As a subform in
the main form, the fields appear as a datasheet even though the fields do not
appear that way in Design view. The heights of the subform’s Form Header and
Form Footer sections are zero, meaning that these sections have been removed
from the subform. You’ll increase the height of the Form Footer section so that you
can add the two calculated controls to the section.
2. Place the pointer at the bottom edge of the Form Footer section bar. When the
pointer changes to a shape, drag the bottom edge of the section down to the
0.5-inch mark on the vertical ruler.
Now you’ll add the first calculated control to the Form Footer section. To create the
text box for the calculated control, you use the Text Box tool in the Controls group
on the Design tab. Because the Form Footer section is not displayed in a datasheet,
you do not need to position the control precisely.
3. In the Controls group on the Design tab, click the Text Box button.
4. Position the + portion of the pointer near the top of the Form Footer section and at
the 1-inch mark on the horizontal ruler, and then click the mouse button. Access
places a text box control and an attached label control to its left in the Form Footer
Next, you’ll set the Name and Control Source properties for the text box. Recall that
the Name property specifies the name of an object or control. Later, when you add the
calculated control in the main form, you’ll reference the subform’s calculated control
value by using its Name property value. The Control Source property specifies the
source of the data that appears in the control; the Control Source property setting can
be either a field name or an expression. You precede expressions with an equal sign to
distinguish them from field names, which do not have an equal sign.
5. Open the property sheet for the text box in the Form Footer section (the word
“Unbound” is displayed inside the text box), click the All tab (if necessary), select
the entry in the Name text box, type txtInvoiceAmtSum in the Name text box,
press the Tab key, type =Sum(InvoiceAmt) in the Control Source text box, and
then press the Tab key. See Figure 6-41.
Setting properties for the subform calculated control
Read the Naming Conven-
tions section in the appen-
dix titled “Relational
Databases and Database
Design” for more informa-
tion about naming
set thes e
text box control
set to Control
Source property value
The calculated control’s Name property setting (txtInvoiceAmtSum) follows a com-
mon naming convention: txt is a prefix tag to identify the control type (a text box),
InvoiceAmt is the name for the related field, and Sum is a suffix tag to identify the
control as a summary control.