Code to Manipulate Expressions

When a new expression is saved to the Expression Store a unique expression ID is created which is used to further access the expression. This section describes how to retrieve the expression ID using the name of the expression. Once the expression ID is retrieved, the expression is renamed, which is the only operation on the expression that is supported through the API. To further manipulate the expression, the corresponding recordset is retrieved and the description of the expression is changed. Finally, the expression is deleted from the Expression Store.

  1. Using the ExpressionStore object, oExpressionStore, created in Code to Connect to the Expression Store, translate the name of the expression, "Expr_WA_Joe", created in Code to Create a New Expression into its expression ID.

    Dim lExpressionID
    lExpressionID = oExpressionStore.GetExprID("Expr_WA_Joe")
    
  2. Rename the expression to "Expr_2001.93".

    oExpressionStore.RenameExpression lExpressionID, "Expr_2001.93"
    
  3. Retrieve the recordset corresponding to the expression.

    Dim rsExpression
    Set rsExpression = oExpressionStore.GetExpression(lExpressionID)
    
  4. Change the description of the expression.

    rsExpression.Fields("ExprDesc").Value = _
     "Is the user named Joe and from WA?" 
    
  5. When finished using the expression, delete it. If the expression has a non-zero reference count (one or more other expressions depend on this expression), the method will fail and the expression will not be deleted.

    oExpressionStore.DeleteExpression lExpressionID, 0
    
    Set rsExpression = Nothing
    


All rights reserved.