Repeating table Button fails - InfoPath Dev
in

InfoPath Dev

Repeating table Button fails

Last post 09-02-2005 10:43 PM by Agni Jonnalagadda. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-02-2005 11:16 AM

    Repeating table Button fails

    The "insert item" code on a repeating is as listed below;
    I have disabled this option from the repeat1ng table and added a button, then applied the same code to the button and it fails.

    I get a runtime error:
    The following error occurred:

    Object required: 'thisXDocument'
    File:script.vbs
    Line:21

    Why? what am I missing?

    ***************************************************************
    Sub CTRL8_5_OnClick(eventObj)
    ' get a reference to the node the repeating table is bound to
    IXMLDOMNode row = thisXDocument.DOM.selectSingleNode("//my:repeatingtable1")
    ' make a copy of the node by cloning it
    row = row.cloneNode(true)
    ' set the new values of the row#%92s fields
    row.selectSingleNode("my:field1").text = "new row field 1"
    row.selectSingleNode("my:field2").text = "new row field 2"
    row.selectSingleNode("my:field3").text = "new row field 3"
    ' append the cloned row to the parent node
    IXMLDOMNode parent = thisXDocument.DOM.selectSingleNode("/my:myFields")
    parent.appendChild(row)
    End Sub
    *************************************************************

    Kip Bautista
    KTB Dezines
    [email protected]
  • 09-02-2005 02:54 PM In reply to

    Re: Repeating table Button fails

    What is line 21?

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 09-02-2005 03:42 PM In reply to

    Re: Repeating table Button fails

    Patrick-
    Line 21 is

    IXMLDOMNode row = thisXDocument.DOM.selectSingleNode("//my:repeatingtable1")


    Kip Bautista
    KTB Dezines
    [email protected]
  • 09-02-2005 10:43 PM In reply to

    Re: Repeating table Button fails

    Looks like you are using thisXDocument instead you should use "XDocument" in the script.
    Your code should look like this

    dim oNode
    set oNode = XDocument.DOM.selectSingleNode("//my:repeatingtable1")

    I dont think you can declare object types in the script, mainly the way you have declared.
    For ex:- "IXMLDOMNode row" is not allowed in script.

    Agni
    InfoPath Dev India
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.