Automatically set a field's value

Microsoft Office InfoPath 2003

Show All Show All

Automatically set a field's value

When designing a form, you can create a rule that automatically sets a field's value in response to an event. This event can include a change to a particular field or group in the data source, clicking a button, the insertion of a repeating section or row in a repeating table, or the opening or submission of a form.

ShowTip

  1. In design mode, do one of the following:
    • To run the rule when a particular field or group in the data source is changed, open the Data Source task pane, double-click the field or group, and then click the Rules tab.
    • To run the rule when the value of a control is changed, double-click the control, and then on the Data tab in the Control Properties dialog box, click Rules.
    • To run the rule when the form is opened, click Form Options on the Tools menu, click the Open and Save tab, and then click Rules.
    • To enable the form's default submit command to run the rule, click Submitting Forms on the Tools menu, and then click Enable Submit commands and buttons. In the Submit to list, click Custom submit using rules, and then click Rules.
    • To run the rule when a button is clicked, double-click the button, click Rules and Custom Code in the Action list, and then click Rules.
  2. In the Rules dialog box or on the Rules tab, click Add.
  3. In the Name box in the Rule dialog box, type a name for the rule.
  4. To specify when the rule should run, click Set Condition, and then enter the condition. The rule will run when the event specified in step one occurs and the condition specified in this step is met.
  5. Click Add Action.
  6. In the Action list in the Action dialog box, click Set a field's value.
  7. In the Field box, click Button image, and then in the Select a Field or Group dialog box, select the field you want to update.

    Note  If your form uses more than one data source, click the one you want in the Data Source list. If your form only uses one data source, the Data Source box is unavailable.

  8. Do one of the following:
    • To update the field with a static value, type the value in the Value box.
    • To update the field based on a formula, click Insert Formula Button image, and then enter the formula in the Insert Formula dialog box.
  9. If you want to prevent any rules from running after this rule (for the current event), select the Stop processing rules when this rule finishes check box in the Rule dialog box.

Note  The information in this topic may not apply if you are working with a form designed using Microsoft Office InfoPath 2003 without the service pack installed. Learn more