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 / February 2008

Tip: Looking for answers? Try searching our database.

Infopath - linked to Access database - on load

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Susan - 31 Jan 2008 20:35 GMT
I am trying to retrieve the user's network id on load of a form.This form is
linked to an Access database called OSS_Calls.mdb - table name OSS Calls
field name to update is Operator. I have my script language set to VB script
on the form.
I have tried different ways of passing the Operator field but keep getting
an "invalid character" on load.
I got this code from a post on this site.

Sub XDocument_OnLoad(eventObj
XDocument.DOM.selectSingleNode("my:myfields/my:datafields/my:Operator").text = Environment.UserName
End Sub

scenarios I have tried are

("my:myfields/my:Operator").text
("my:myfields/my:datafields/my:Operator").text
("my:myfields/my:datafields/d:OSS_Calls/my:Operator").text
("my:myfields/my:datafields/d:OSS_Calls/:Operator").text

I would appreciate anyone's input on what I am doing wrong, or if this will
work.
S.Y.M. Wong-A-Ton - 01 Feb 2008 05:44 GMT
I don't think this will work, Susan. "Environment.UserName" is not known in
VBScript; it can only be used in .NET (managed) code. I'm not sure what the
"invalid character" would be in the code, but what you can do is set the
expression to a static string like "Test Operator" first and see whether that
works.

So do something like:
XDocument.DOM.selectSingleNode("my:myfields/my:datafields/my:Operator").text
= "Test Operator"

and see if that works. And also, the namespace for "dataFields" might have
to be "dfs:" instead of "my:"; but it's hard to say without knowing what the
XML of your form looks like. Once you get that to work, you can use the
"WScript.Network" object to retrieve a user name. See
http://www.pctools.com/guides/scripting/detail/108/?act=reference and also do
a search in this newsgroup on "WScript Network UserName". If you're on Win
XP, I think you'll also have to install "Windows Script", otherwise the
WScript object will not be known.
---
S.Y.M. Wong-A-Ton

> I am trying to retrieve the user's network id on load of a form.This form is
> linked to an Access database called OSS_Calls.mdb - table name OSS Calls
[quoted text clipped - 17 lines]
> I would appreciate anyone's input on what I am doing wrong, or if this will
> work.
Clay Fox - 01 Feb 2008 06:31 GMT
Hi Susan.

Identifying the user is very important for any workflow or audit ability in
your forms.

In my opinion, using a web service is easier for harvesting a user's Active
Directory information is the best.

A drop back of local code is that it often requires a full trust,
installable form and it returns the local user account. This can be a problem
in a VPN/RAS/ remote user situation where you would want their network/domain
credentials.

Here is a link with a video tutorial
http://www.qdabra.com/proddetail.asp?prod=QADWS

An Active Directory web service can be used codelessly and returns their
network credentials.  It also will return address, full name, email,
location, manager, etc from Active Directory.
Signature

Clay Fox / Microsoft InfoPath MVP
www.InfoPathDev.com / The InfoPath Authority / Downloads, Samples, How-To,
Experts, Forum

> I am trying to retrieve the user's network id on load of a form.This form is
> linked to an Access database called OSS_Calls.mdb - table name OSS Calls
[quoted text clipped - 17 lines]
> I would appreciate anyone's input on what I am doing wrong, or if this will
> work.
 
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.