|InfoPath Developer Reference|
Version Added: InfoPath 2003
expression.Add(varNode, bstrConditionName, bstrShortErrorMessage, bstrDetailedErrorMessage, lErrorCode, bstrType)
expression An expression that returns a Errors object.
|varNode||Required||Variant||The XML node that the error will be associated with.|
|bstrConditionName||Required||String||The name of the error.|
|bstrShortErrorMessage||Required||String||The short message for the error.|
|bstrDetailedErrorMessage||Optional||String||The detailed message for the error.|
|lErrorCode||Optional||Long||Default value is 0. The error code of the error.|
|bstrType||Optional||String||Default value is modeless. The type of error processing. The other supported value is modal.|
The Add method is used to create custom error messages in a Microsoft Office InfoPath 2007 form. There are two types of errors that can be created using the Add method:
- modeless: The user is notified of the error with an inline alert and can choose to return to the previous value with an undo operation.
- modal: The user is notified of the error with a dialog box alert. After clicking OK in the dialog box alert, the error will appear as an inline alert and the user can choose to return to the previous value with an undo operation.
Security Level 2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
In the following example, the Add method of the Errors collection is used to create a custom error message: