[ Team LiB ] Previous Section Next Section

Using Expressions to Enhance Forms

A control can contain any valid expression as its control source. When you enter an expression as a control source, the expression must be preceded by an equal sign. You can manually type the control source, or you can use the Expression Builder to make the process easier.

To add an expression to a control source, you start by adding an unbound control to a form. To use the Expression Builder, you click the control's Control Source property and then click the ellipsis (…). The Expression Builder appears (see Figure 16.10). In the list box on the left, you select the type of object you want to include in the expression. The middle and right list boxes let you select the specific element you want to paste into the expression. The Expression Builder is useful when you're not familiar with the syntax required for the expression. You can also enter an expression directly into the text box for the Control Source property. To view the expression more easily, you can use the Zoom feature (Shift+F2). The Zoom dialog box for the control source is pictured in Figure 16.11; the expression shown in the figure multiplies UnitPrice by Quantity.

Figure 16.10. The Expression Builder, where you can add an expression as a control's control source.

graphics/16fig10.jpg

Figure 16.11. The Zoom dialog box for a control source.

graphics/16fig11.jpg

    [ Team LiB ] Previous Section Next Section