<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Was getting current user name on form before data connection....</title><link>https://www.infopathdev.com:443/forums/thread/39842.aspx</link><pubDate>Mon, 23 Mar 2009 11:49:11 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39842</guid><dc:creator>pellj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39842.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=39842</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;Thanks, I will definetly give it a try!!!!</description></item><item><title>Re: Was getting current user name on form before data connection....</title><link>https://www.infopathdev.com:443/forums/thread/39814.aspx</link><pubDate>Sat, 21 Mar 2009 12:34:51 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39814</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39814.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=39814</wfw:commentRss><description>&lt;p&gt;Hi, and welcome:&lt;/p&gt;
&lt;p&gt;You will have to modify your code to the correct XPath for your new form:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; user = root.SelectSingleNode(&amp;quot;&lt;strong&gt;/my:myFields/my:employee&lt;/strong&gt;&amp;quot;, Me.NamespaceManager)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;The bold section needs the XPath to the field you&amp;#39;d like to put the user error in. You can right click the field in the &lt;strong&gt;Data Source Task Pane&lt;/strong&gt; on the form when it is in Design mode, and paste the correct XPath in the quotes. You are getting an error because the XPath doesn&amp;#39;t point to a valid node, thus user, which you are trying to set a value on, is null.&lt;/p&gt;</description></item><item><title>Was getting current user name on form before data connection....</title><link>https://www.infopathdev.com:443/forums/thread/39678.aspx</link><pubDate>Wed, 18 Mar 2009 14:43:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:39678</guid><dc:creator>pellj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/39678.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=39678</wfw:commentRss><description>&lt;p&gt;First off thanks for viewing my first question.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I had a form that was&amp;nbsp;not connected to a database that used the following code form &lt;a href="http://msdn.microsoft.com/en-us/library/aa942693(VS.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa942693(VS.80).aspx&lt;/a&gt;&amp;nbsp;to get the current username in real time so that permission to fields could be controlled by the currrent user.&lt;/p&gt;
&lt;p&gt;Public Sub FormEvents_Loading(ByVal sender As Object, ByVal e As LoadingEventArgs)&lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim root, user As System.Xml.XPath.XPathNavigator&lt;br /&gt;&amp;nbsp;&amp;nbsp; root = Me.MainDataSource.CreateNavigator&lt;br /&gt;&amp;nbsp;&amp;nbsp; user = root.SelectSingleNode(&amp;quot;/my:myFields/my:employee&amp;quot;, Me.NamespaceManager)&lt;br /&gt;&amp;nbsp;&amp;nbsp; user.SetValue(System.Environment.UserName)&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;Now I have a database that I want to use as a base for the&amp;nbsp;form. Since I have created&amp;nbsp;the database and&amp;nbsp;need to submit and review data, I create the form from the&amp;nbsp;database table.&amp;nbsp; Now when I&amp;nbsp;add the&amp;nbsp;code&amp;nbsp;below I always get a&amp;nbsp;null error&amp;nbsp;on the &amp;nbsp;following line:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; user.SetValue(System.Environment.UserName)&lt;/p&gt;
&lt;p&gt;I noticed that on the design task/data source screen,&amp;nbsp;non database form had new field &amp;quot;user&amp;quot;, database connected form has &amp;quot;my:user&amp;quot;.&amp;nbsp; This&amp;nbsp;must&amp;nbsp;be throwing off the code&amp;nbsp;but I don&amp;#39;&amp;nbsp;t see where one would alter code&amp;nbsp;for this extra &amp;quot;my:&amp;quot;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please advise,&lt;/p&gt;
&lt;p&gt;Jason&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>