XDocument.OnAfterImport Event

InfoPath Developer Reference

Occurs after the import (or merge) operation has successfully completed.

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.OnAfterImport(pEvent)

expression   An expression that returns a XDocument object.

Parameters

Name Required/Optional Data Type Description
pEvent Required DocEvent

Return Value
nothing

Remarks

This event handler does not allow users to cancel an operation.

If the merge operation includes merging multiple forms, the OnAfterImport event occurs only after all forms have been merged and the complete operation is successful.

Bb229733.vs_note(en-us,office.12).gif  Note
The OnAfterImport event handler cannot be created using Microsoft Office InfoPath 2007 design mode; it must be created manually.

Creating the OnAfterImport event handler

To create the OnAfterImport event handler, you must add the OnAfterImport event handler declaration to the form's primary scripting file. Open Microsoft Script Editor (MSE) and enter the following event handler declaration:

JScript syntax

JScript
  function XDocument::OnAfterImport(eventObj)
{
   // Write your code here.
}

VBScript syntax

Visual Basic for Applications
  Sub XDocument_OnAfterImport(eventObj)
   ' Write your code here.
End Sub

Example

In the following example, the OnAfterImport event handler is used to display a message box that informs the user that the merge operation completed successfully:

JScript
  function XDocument::OnAfterImport eventObj)
{
   XDocument.UI.Alert("Merge operation was successful.")
}

See Also