Community articleSetFormula function
Added by IBM contributorIBM on August 15, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function sets the formula for a node.


   Sub SetFormula(
      theComputation As String)


Table 1. Function parameters
theFormulaStringThe formula to assign to the node. If null, the formula is assigned as null.


Nothing if call is successful or throws an exception if an error occurs.


The following function sets the formula in a field so that it will copy a value from another item in the form. First, the function uses DereferenceEx to locate the field. The function then calls SetFormula to set the field to copy the value of another field.
   Sub AddFormula(Form)
      Dim TempNode  ' object
      Set TempNode = Form
      ' Locate the value node for the NameLabel on page 1.
      Set TempNode = TempNode.DereferenceEx(vbNullString, _
         "PAGE1.NameLabel.value", 0, UFL_OPTION_REFERENCE, Nothing)
      ' Set a formula for the node that will copy the value of the NameField
      ' into the NameLabel.
      TempNode.SetFormula "NameField.value"   
End Sub

Parent topic:
FormNodeP functions