catastrophic error in infopath

B

Buddyguy

hey everyone i am still very new to this and I have an infopath form created
with the tools for office. and the submit button has the following code

im xpath As String = "/my:group1/my:group2/my:ExpenseDetails"

Dim oNodeList As IXMLDOMNodeList

Dim oNode As IXMLDOMNode

Dim oField As IXMLDOMNode

Dim txtID = thisXDocument.DOM.selectSingleNode("/my:txtID")

Dim txtexpdate = thisXDocument.DOM.selectSingleNode("/my:txtexpdate")

Dim txtOrgadd = thisXDocument.DOM.selectSingleNode("/my:txtOrgadd")

Dim txtOrgmun = thisXDocument.DOM.selectSingleNode("/my:txtOrgmun")

Dim txtDesadd = thisXDocument.DOM.selectSingleNode("/my:txtDesadd")

Dim txtDesmun = thisXDocument.DOM.selectSingleNode("/my:txtDesmun")

Dim txtPurpose = thisXDocument.DOM.selectSingleNode("/my:txtPurpose")

Dim txtKM = thisXDocument.DOM.selectSingleNode("/my:txtKM")

Dim txtNMdesc = thisXDocument.DOM.selectSingleNode("/my:txtNMdesc")

Dim txtExpamt = thisXDocument.DOM.selectSingleNode("/my:txtExpamt")

Dim txtRegKM = thisXDocument.DOM.selectSingleNode("/my:txtRegKM")

Dim txtKMrateReg = thisXDocument.DOM.selectSingleNode("/my:txtKMrateReg")

Dim txtKMrateXS = thisXDocument.DOM.selectSingleNode("/my:txtKMrateXS")

Dim txtMilCalc = thisXDocument.DOM.selectSingleNode("/my:txtMilCalc")

oNodeList = thisXDocument.DOM.selectNodes(xpath)

If (oNodeList.length > 0) Then

For Each oNode In oNodeList

If (oNode.nodeType = DOMNodeType.NODE_ELEMENT) Then

txtID.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:ItemId")

txtexpdate.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:ExpenseDate")

txtOrgadd.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/myrigAddress")

txtOrgmun.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/myrigMuncipality")

txtDesadd.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/myesAddress")

txtDesmun.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/myesMunicipality")

txtPurpose.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/myurpose")

txtKM.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:KM")

txtNMdesc.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:NonMileageExp")

txtExpamt.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:ExpenseAmt")

txtRegKM.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:RegKM")

txtKMrateReg.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:KMRateReg")

txtKMrateXS.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:KMRateExcess")

txtMilCalc.text =
oNode.selectSingleNode("/my:group1/my:group2/my:ExpenseDetails/my:MileageCalc")

End If

For Each WebServiceAdp As WebServiceAdapter2 In thisXDocument.DataAdapters

If WebServiceAdp.Name = "Submit" Then

WebServiceAdp.Submit()

End If

Next

Next

End If





what is happening is when i press the submit button i get a catastrophic
error and it points to this line

Dim txtID = thisXDocument.DOM.selectSingleNode("/my:txtID")

saying that thisxdocument caused the error.



whats going on???



thanks in advance
 
G

Gavin McKay

Hello,

I'm assuming that you are using InfoPath 2003...

Can you tell what the contents of thisXDocument are? Is it null or has it
been set properly by InfoPath? Usually you would get this error when
thisXDocument isn't set, so therefore it has no "DOM" method/property.

Gavin.
 
B

Buddyguy

HI Gavin,

i looked at that and at the beginning of the code it declares xdocument.
when i am in tommorow i will send you the code.

Thanks

Arley
 
B

Buddyguy

ok here is the code where it declares xdocument
Private thisXDocument As XDocument
Private thisApplication As Application

'Declare object for shared code
Private objShared As cscShared.InfoPathTools

Public Sub _Startup(ByVal app As Application, ByVal doc As XDocument)
thisXDocument = doc
thisApplication = app

' You can add additional initialization code here.
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top