ExpressionStore.SaveExpression
Use this method to save a new or modified expression to the expression store. For a new expression, the SaveExpression method automatically generates a unique expression ID and stores it with the expression.
Definition
Sub SaveExpression(pRSExpr As Object)
Parameters
pRSExpr
[in] A Recordset object that contains the expression.
Return Values
None.
Error Values
This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.
The following table shows the custom COM errors that this method can return.
Constant | Value | Description |
E_EXPR_BADCONNECTION | &H8110001F | Invalid connection |
E_EXPR_BADEXPRBODY | &H81100004 | Invalid or missing expression body |
E_EXPR_BADEXPRCATEGORY | &H8110000A | Invalid expression category specified |
E_EXPR_BADEXPRNAME | &H81100003 | Invalid expression name |
E_EXPR_CYCLEDETECTED | &H81100006 | A cycle was detected in the expression dependencies of this expression |
E_EXPR_DUPEXPRDEPS | &H81100009 | Duplicate expression dependency |
E_EXPR_DUPEXPRNAME | &H81100007 | Duplicate expression name |
E_EXPR_DUPPROFDEPS | &H81100008 | Duplicate profile dependency |
E_EXPR_INVALIDEXPRDEPS | &H8110000B | One or more of the expression dependencies refers to an expression ID that does not exist |
E_EXPR_INVALIDFIELDSIZE | &H81100005 | The new name exceeds the maximum size of 30 characters |
E_EXPR_NOCONNECTIONSTRING | &H8110000D | No connection string specified |
E_EXPR_NOPROFDEPS | &H81100002 | Expression must have at least one profile-dependency to be saved |
Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.
Remarks
If the expression being saved is not currently in the expression store, the SaveExpression method generates a unique identifier and populates the ExprID field of the Recordset object. The identifier is a positive integer. For more information about the format and fields of the Recordset object, see Expression Recordset.
The ExpressionStore object performs rudimentary checks for expression dependencies when an expression is saved or deleted. This includes any direct references, a test for cyclic referencing, and any references to non-existent expressions.
Call the Connect method before calling the SaveExpression method.