Microsoft Office Tutorials and References
In Depth Information
You’ve finished creating the first calculated control, and now you’ll create the other
calculated control.
6. Repeat Steps 3 through 5, positioning the + portion of the pointer near the top of
the Form Footer section and at the 4-inch mark on the horizontal ruler, setting the
Name property value to txtInvoiceNumCount , and setting the Control Source
property value to =Count(InvoiceNum) .
When you use the Count function, you are counting the number of displayed
records—in this case, the number of records displayed in the subform. Instead of
using InvoiceNum as the expression for the Count function, you could use any of
the other fields displayed in the subform.
You’ve finished creating the subform’s calculated controls, so you can close the
property sheet, save your subform design changes, and return to the main form.
7. Close the property sheet, save your subform changes, and then close the subform.
You return to Design view for the main form.
Next, you’ll add two calculated controls in the main form to display the values of the
two calculated controls from the subform.
Adding Calculated Controls to a Main Form
The subform’s calculated controls now contain a count of the number of invoices and a
total of the invoice amounts. You need to add two calculated controls in the main form
that reference the values in the subform’s calculated controls. Because it’s easy to make a
typing mistake with these references, you’ll use Expression Builder to set the Control
Source property for the two main form calculated controls.
To add a calculated control to the main form’s Detail section:
1. In the Controls group on the Design tab, click the Text Box button, and then add
the text box and its attached label in the Detail section, clicking the + portion of
the pointer at the 2-inch mark on the horizontal ruler and the 2-inch mark on the
vertical ruler. Don’t be concerned about positioning the control precisely, because
you’ll resize and move the label and text box later.
2. Select the label and open the property sheet, set its Caption property to Number of
Invoices: , right-click an edge of the label to open the shortcut menu, point to Size ,
and then click To Fi t . Don’t be concerned if the label now overlaps the text box.
You’ll use Expression Builder to set the Control Source property for the text box.
3. Click the text box (the word “Unbound” is displayed inside the text box) to select
it, click the Control Source text box in the property sheet, and then click the
property’s Build button to open Expression Builder.
4. Double-click frmContractsAndInvoices in the left column, click frmInvoiceSubform
in the left column, scroll down the middle column, click txtInvoiceNumCount in the
middle column, and then click the Paste button. See Figure 6-42.
Search JabSto ::

Custom Search