Community articleRemoveEnclosure function
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function will either remove an enclosure from a specific datagroup or delete the enclosure from the form. Call this function on the IFormNodeP that contains the enclosure that you want to remove.


   Sub RemoveEnclosure(
      theDataGroup As String)


Table 1. Function parameters
theDataGroupStringThe datagroup that contains the enclosed item. If null, the item will be removed from all datagroups. If an item no longer belongs to any datagroups, it is deleted from the form.


Nothing if call is successful or throws an exception if an error occurs.


The following function locates an attachment in a form an deletes it. First, the function uses DereferenceEx to locate the node that contains the attachment. Next, the function calls RemoveEnclosure to delete the attachment.
   Sub DeleteAttachment(Form)
      Dim TempNode  ' object    
      Set TempNode = Form
      ' Locate the PAGE3.DATA1 item, which contains the enclosure
      Set TempNode = TempNode.DereferenceEx(vbNullString, "PAGE3.DATA1", _
         0, UFL_ITEM_REFERENCE, Nothing)
      ' Delete the enclosure
      TempNode.RemoveEnclosure vbNullString
   End Sub

Parent topic:
FormNodeP functions