Placing a Conditional Object
A conditional object is a multi-level rectangular frame used to conditionally display and hide groups of objects. Conditional objects behave like tabbed subforms, except that instead of tabs, the object has multiple layers, which appear and disappear based on the expressions you enter. A layer appears when its expression evaluates to TRUE. If no expression evaluates to true, the default layer appears.
On a form you can use a conditional object to display or hide groups of fields and objects. For example, on your Invoice form of the AlphaSports sample database, you have radio buttons that allow the user to choose the type of payment. The possible choices are Cash, Check, and Credit Card. By clicking the Credit Card button, fields can appear in which the user enters the card number and expiration date. By clicking the Check button, fields can appear in which the user can enter the check number. Through the use of a conditional object, fields related to a credit card sale appear when the user clicks the Credit Card radio button. On a Report you can use a conditional object to suppress sections from printing. For example, you have an inventory report in which product records are divided by category. In the group footer you have fields that display the total and average prices of the current category. In cases where there is only one product in the category, you can suppress the group footer information, since the total and average are redundant.
Placing a Conditional Object
You create conditional objects by using the Conditional Object tool on the Toolbox.
Once the conditional object has been created, you can assign conditions to each layer as well as set other properties. Once the properties have been set, you can add objects to each of the layers.
Open the layout you want to edit in either the Form Editor or the Report Editor.
From the View menu, choose Toolbox to make the Toolbox is visible (if necessary).
On the Toolbox, click the Conditional Object tool.
Click and drag over the area on which you want to place the conditional object. When you release the mouse button, the conditional object is created.
Right click on the conditional object. The right click menu appears.
From the right click menu, choose Properties. The Properties dialog box appears.
Optionally, change the object's name.
Optionally, select Object can shrink. This allows the conditional object to adjust to the size of the objects it contains. Note: Objects placed in page headers or footers cannot shrink because the size of the page header or footer has to be the same for every page on the report.
Add as many conditions (layers) as you require. To add a condition:
1. Click "".
2. Enter an expression that evaluates to a logical value (TRUE or FALSE) in the Condition Expression field. Optionally, click to build the expression in the Expression Builder.
3. Add a descriptive name for the condition in the Label field.
Repeat steps 9a through 9c for each additional condition (layer).
Click OK to return to the Form Editor or the Report Editor.
Adding Objects to a Layer
In the Form Editor or the Report Editor, right click on the conditional object. The right click menu appears.
1. From the top of the right click menu, choose the layer where you want to add an object ( Note : All the layers you defined in its Properties dialog, including the Default layer, appear at the top of the right click menu.)
2. Add new objects to the conditional object the same way you would add objects to a form. For example, to add a new field, click and drag a field from the Drag-and-Drop List and drop it on the conditional object.
Repeat steps 12a and 12b for each layer.