Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Thread Tools Display Modes
Old 04-30-2006, 01:12 PM
Zainebq Zainebq is offline
Infopath Onversionchange
Join Date: Apr 2006
Posts: 1
Send a message via AIM to Zainebq Send a message via MSN to Zainebq Send a message via Yahoo to Zainebq
Default Infopath Onversionchange

Hi. I am working on this Infopath template. I made some changes to the original version, and wanted to reversion the template. In the new template I added an xml node to the schema. But now when I try to open the old files, it gives an error because that node cannot be found in the old version.

I was trying to use the onversionchange procedure as given in msdn website. But it is not working. I thought I might need an XPath, but still doesnt seem to work. When I use an XPath, I need to save the new node to the XDocument and it does not seem to work. Can someone please help me regarding this. I will be REALLY thankful!

The code I currently have is as follows:

Sub XDocument_OnVersionUpgrade(eventObj)
if XDocument.DOM.selectsingleNode("/my:myFIelds/my:field3") is Nothing

'->following is setting up the xPath. I need to specify the "my" namespace
Dim oDomNewNode
set oDomNewNode = createobject("msxml2.domdocument.5.0")
oDomNewNode.loadXML XDocument.DOM.xml
oDomNewNode.setProperty "SelectionLanguage", "XPath"
oDomNewNode.setProperty "SelectionNamespaces",

Dim objItemNode, objItemAddNode, checkNode
set objItemNode =
oDomNewNode.selectSingleNode("/my:myFields").ownerDocument.createElement("field3" )
set objItemAddNode =
XDocument.DOM.selectsingleNode("/my:myFields").ownerDocument.createElement("field3" )

' Add the new <item> element to the XML document as a
' child of the <order> element.
set checkNode = oDomNewNode.selectSingleNode("/my:myFields").appendChild(objItemNode)

checkNode.text = "this is field3"

'--->Here i was trying to save to the XDocument. But its wrong
end if
end sub
Reply With Quote

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
InfoPath 2003 on XP machine BarryG Misc 0 11-13-2008 11:03 PM
Infopath Onversionchange Infopath ole db intialization Lynsnewt Misc 2 11-16-2005 08:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:31 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2022 DragonByte Technologies Ltd. is not affiliated with Microsoft