Microsoft Office Tutorials and References
In Depth Information
Changing the Way Your Form Looks Dynamically
Hiding unneeded controls on a form
On an order form, if the payment method isn’t purchase order, what’s the
point of displaying a place to type a purchase order number? How cool
would the form be if it could hide the PO Number control if the Payment
Method control didn’t contain the value Purchase Order?
Follow these steps to make a submacro that changes the properties of a
1. Open your macro in Design view.
To do this, right-click the macro in the Navigation Pane and choose
Design View from the contextual menu.
2. Make a submacro named something like ShowHidePONumber.
Double-click Submacro in the Action Catalog, or drag a Submacro from
the Action Catalog to your macro.
The order of the submacros in a macro doesn’t matter; each submacro
runs only when it’s called or triggered.
3. Add an If action to your macro.
You can choose If from the Add an Action drop-down menu in the
submacro box or drag If from the Action Catalog into your submacro.
4. In the If box, type the condition under which you want to change the
property of the control.
In Figure 2-7, the condition is [Payment Method] = “Purchase
Order”. The submacro displays the PO Number control if this condition
is True and hides it otherwise.
control if the
In Figure 2-7, the macro hides a text box control if a control is blank
(null) and displays the text box if the control isn’t blank. You’d probably