This documentation is archived and is not being maintained.

Errors.Delete Method

Office 2007
Deletes the specified Error object from the Errors collection.

Version Information
 Version Added:  InfoPath 2003


expression.Delete(varNode, bstrConditionName)

expression   An expression that returns a Errors object.


NameRequired/OptionalData TypeDescription
varNodeRequiredVariantThe XML Document Object Model (DOM) node associated with the error.
bstrConditionNameRequiredStringThe name of the error.

Return Value


The Delete method deletes all the Error objects in the Errors collection that are associated with the specified XML node and that have the same name. To delete all of the Error objects contained in the Errors collection, use the DeleteAll method.

Bb229758.vs_note(en-us,office.12).gif  Note
The Delete method will only delete errors that were created using the Add method of the Errors collection. It cannot be used to delete errors that occur because of schema or data validation constraints, or errors that were created using the ReportError method of the DataDOMEvent object.

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 Delete method of the Errors collection is used to delete all the errors based on their associated XML node and name:

XDocument.Errors.Delete(MyXMLNode, "ValidationError");