Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2006

Tip: Looking for answers? Try searching our database.

Passing valuse from VBScript to InfoPath field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
craigster76 - 07 Sep 2005 22:13 GMT
I am trying to obtain the network username when an InfoPath form loads, then
assign that username to a field in the form. I have tried many different
variations of examples that I have found, but none have worked. Below is the
code I am using in the "Sub XDocument_OnLoad(eventObj)" event:

XDocument.DOM.selectSingleNode("field2").Text = objNet.UserName

Any ideas on how to pass the value of the username from the script to a
field on the form?

Craig
Franck Dauché - 08 Sep 2005 05:38 GMT
Hi Craig,

Once you get your objNet initialized (new ActiveXObject("WScript.Network"),
you need to assign you objNet.UserName to:
XDocument.DOM.SelectSingleNode(full XPath for the root to field2), not just
field2.  Your path should look like: /my:rootName/my:......./my:field2".

Hope that helps.

Franck Dauché

> I am trying to obtain the network username when an InfoPath form loads, then
> assign that username to a field in the form. I have tried many different
[quoted text clipped - 7 lines]
>
> Craig
craigster76 - 08 Sep 2005 17:39 GMT
Franck,

Thank you for your assistance. I have tried using the full xpath, but still
am unsuccessful. The full xpath looks like this:

XDocument.DOM.selectSingleNode("/my:myFields/my:field2") = objNet.UserName

Is my xpath incorrect?

Craig

> Hi Craig,
>
[quoted text clipped - 18 lines]
> >
> > Craig
Franck Dauché - 09 Sep 2005 02:46 GMT
No, you are fine, but you need a ".text" before the = sign...

Franck Dauché

> Franck,
>
[quoted text clipped - 29 lines]
> > >
> > > Craig
SDecou - 15 Mar 2006 20:25 GMT
I am receiving an error when I try to use ("WScript.Network") in Infopath
using VBScript.  Have anyone been successful getting this to work?  This is
what my code looks like:

Dim objNetwork
objNetwork = new ActiveXObject("WScript.network")
msgbox objNetwork

I am receiving an error and  have tried using a SET statement which still
doesn't work.

> Hi Craig,
>
[quoted text clipped - 18 lines]
> >
> > Craig
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.