The Data Properties of a Control
The Data properties of a control (see Figure 8),
described in the following list, specify information about the data
underlying a particular report control. Using the Data properties, you
can designate everything from what data displays in a control, to
whether the data sums as it displays:
Control Source— The Control Source
property specifies the field in the report’s record source that’s used
to populate the control. An example is FirstName. A control source can
also be a valid expression.
Running Sum— The Running Sum
property (which is unique to reports) is powerful. You can use it to
calculate a record-by-record or group-by-group total. You can set it to
No, Over Group, or Over All. When set to No, no running sum is
calculated. When it is set to Over Group, the value of the text box
accumulates from record to record within the group but is reset each
time the group value changes. An example is a report that shows deposit
amounts for each state, with a running sum for the amount deposited
within the state. Each time the state changes, the amount deposited is
set to zero. When this property is set to Over All, the sum continues
to accumulate over the entire report.
The Other Properties of a Control
The Other properties of a control include properties, such as the following, that don’t fit into any other category (see Figure 9):
A common mistake many Access developers and users
make is to give controls names that conflict with Access names. This
type of error is difficult to track down. You need to make sure you use
distinctive names for both fields and controls. Furthermore, you should
not give a control the same name as a field within its expression. For
example, the expression =ContactName & ContactTitle shouldn’t have the name ”ContactName”; that would cause an #error#
message when you run the report. Finally, you shouldn’t give a control
the same name as its control source. Access gives a bound control the
same name as its field, and you need to change this name to avoid
problems. Following these simple warnings will spare you a lot of grief!
|
Name— The Name
property provides an easy and self-documenting way to refer to a
control in Visual Basic for Applications (VBA) code and in many other
situations. You should name every control so that you can easily
identify them in queries, macros, and so on.
Vertical— The Vertical
property is used to determine whether the text within a control is
displayed vertically. The default value for this property is No.
Tag— Like the Tag property of a report, the Tag property of a control provides a user-defined slot for the control. You can place extra information in the Tag property.