Scripting and Object Is Required Error

M

mbenbow

This has happened to me more than once when coding in VBScript for an
InfoPath form. If you know that your XPath statement is correct using
Xdocument.DOM.SelectSingleNode("//my:FieldName") but an error keeps
occuring in the script file telling you that an Object is required.
Ensure that the following namespaces in the script file are as follows.


'<namespacesDefinition>
XDocument.DOM.setProperty "SelectionNamespaces",
"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:eek:d=""urn:schemas-microsoft-com:eek:fficedata""
xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD""
xmlns:xd=""http://schemas..microsoft.com/office/infopath/2003"""

'</namespacesDefinition>

Somtimes, when InfoPath creates the script file, it leaves off a name
space. In each instance that this has occurred the

xmlns:eek:d=""urn:schemas-microsoft-com:eek:fficedata""

was missing and therefore the form did not understand how to reference
the XML element in code. Adding the namespace to the script file
resolved the issue.

Hope it helps someone else.
 

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

Top