<?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: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99872.aspx</link><pubDate>Thu, 30 Oct 2014 22:15:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99872</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99872.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99872</wfw:commentRss><description>&lt;p&gt;The code sample you posted:&lt;font color="#008000"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;//Load new workforce string into a temporary XML document&lt;br /&gt;XmlDocument tempDoc = new XmlDocument();&lt;br /&gt;tempDoc.LoadXml(workforceXml);&lt;/p&gt;
&lt;p&gt;// Insert the new worker record into the main DOM.&lt;br /&gt;XPathNavigator newWorker = tempDoc.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Weekly_Hours&amp;quot;, NamespaceManager);&lt;br /&gt;workforceList.AppendChild(newWorker);&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&amp;#39;m saying the newWorker variable in the last line of code must be null to throw that error. When I say your new XML, I mean the tempDoc variable in your code. Do you know how to run your code in debug? &lt;a href="http://www.infopathdev.com/blogs/hilary/archive/2009/09/27/debug-managed-code-in-vsta-for-the-accidental-programmer.aspx"&gt;http://www.infopathdev.com/blogs/hilary/archive/2009/09/27/debug-managed-code-in-vsta-for-the-accidental-programmer.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99871.aspx</link><pubDate>Thu, 30 Oct 2014 22:01:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99871</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99871.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99871</wfw:commentRss><description>&lt;p&gt;newWorker must&amp;nbsp;be null. I&amp;#39;m sorry please forgive me.&amp;nbsp; I am a little lost by your references.&amp;nbsp; When you say my new XML are you referring to my Repeating group (d:Weekly_Hours) in my Main source because this iswhere the repeating table (with secondary info) will appear.&amp;nbsp; When you said XML before I thought you were speaking of my secondary source which happens to be an xml file. How do I check or where do I look for&amp;nbsp;the outer XML for tempDoc? I am so sorry as you can tell I am a bit of a novice and still learning certain programming terms. Do I need to define&amp;nbsp;newWorker somewhere in the code?&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99848.aspx</link><pubDate>Wed, 29 Oct 2014 21:33:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99848</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99848.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99848</wfw:commentRss><description>&lt;p&gt;So - newWorker is not null? The error message makes it sound like it is. Isn&amp;#39;t your new XML just &amp;quot;d:Weekly_Hours&amp;quot;? If you run the code in debug and check the outer XML for tempDoc after loading it, what is the outer XML?&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99842.aspx</link><pubDate>Wed, 29 Oct 2014 18:14:40 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99842</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99842.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99842</wfw:commentRss><description>&lt;p&gt;Thank you! This worked.&lt;/p&gt;&lt;p&gt;However I, of course, did receive other&amp;nbsp;errors but I was able to figure them out. There is one new error that I am having trouble finding a solution to.&amp;nbsp; I am trying to talk out each line of code to figure out just what is trying to be accomplished. In your example I believe you were allowing the user to add a new vehicle to the &amp;quot;Sport&amp;#39;s Car&amp;quot; category&amp;nbsp;if they wanted to.&amp;nbsp; Since I only want the user to select their unit and have &lt;u&gt;only their current&amp;nbsp;unit members&lt;/u&gt; (and not&amp;nbsp;add a new employee) populate the data fields with some info while they input other fields (hrs worked), do I need this line of code that you used?&lt;/p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;p&gt;//Load new workforce string into a temporary XML document&lt;br /&gt;XmlDocument tempDoc = new XmlDocument();&lt;br /&gt;tempDoc.LoadXml(workforceXml);&lt;/p&gt;&lt;p&gt;// Insert the new worker record into the main DOM.&lt;br /&gt;XPathNavigator newWorker = tempDoc.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Weekly_Hours&amp;quot;, NamespaceManager);&lt;br /&gt;workforceList.AppendChild(newWorker);&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font size="2"&gt;You can tell during debugging that it is trying to append all members of the unit but it keeps&amp;nbsp;showing the error message &amp;quot;Value cannot be null Parameter name: newChild&amp;quot;. The number of error msg boxes = number of members in the selected Unit. If I need it how can I adjust these lines&amp;nbsp;of code to work correctly?&amp;nbsp; Thank you again for your endurance and willingness to work with me.&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99832.aspx</link><pubDate>Tue, 28 Oct 2014 22:02:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99832</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99832.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99832</wfw:commentRss><description>&lt;p&gt;Sorry, I just really read this now. :)&lt;/p&gt;
&lt;p&gt;You need to add a closing &amp;lt;/d:Weekly_Hours&amp;gt;&lt;/p&gt;
&lt;p&gt;So, after &amp;lt;/d:Status&amp;gt; we&amp;#39;d need to add a &amp;lt;/d:Weekly_Hours&amp;gt;&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99831.aspx</link><pubDate>Tue, 28 Oct 2014 22:00:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99831</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99831.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99831</wfw:commentRss><description>&lt;p&gt;I think the issue is here:&lt;/p&gt;
&lt;p&gt;string workforceXml = &amp;quot;&amp;lt;d:Weekly_Hours xmlns:my=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;#39;&amp;gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Is d:Weekly_Hours in your main data source? &lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99830.aspx</link><pubDate>Tue, 28 Oct 2014 21:57:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99830</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99830.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99830</wfw:commentRss><description>&lt;p&gt;Adding rows to the main source.&amp;nbsp; User selects department or unit number from the drop-down list (selectedUnit), clicks a button and all members in the unit are listed in the main sources data fields (unit #, last name, first name, position, and status) the other data fields are hrs worked, OT hrs, etc that are filled in by the user.&amp;nbsp; When user is finished they click submit and each row transmits to an access table(main source).&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99829.aspx</link><pubDate>Tue, 28 Oct 2014 19:03:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99829</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99829.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99829</wfw:commentRss><description>&lt;p&gt;Are you trying to add a row to the main data source? Or to the secondary data source?&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99827.aspx</link><pubDate>Tue, 28 Oct 2014 18:28:34 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99827</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99827.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99827</wfw:commentRss><description>&lt;p&gt;Ok. I am slowly walking this down and it occurred to me that I should change the xmlns:&lt;u&gt;my&lt;/u&gt;=&amp;#39;http://schemas.microsoft....... to&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:&lt;u&gt;d&lt;/u&gt;=&amp;#39;http://......&amp;nbsp; I did that as well changed this section to look like this (see below).&amp;nbsp; Did I just make is worse? I changed the&amp;nbsp;&amp;quot;my:&amp;quot; s to &amp;quot;d:&amp;quot; s. &amp;nbsp; The error I am now getting is Unexpected end of file has occurred. The following elements are not closed: d:Weekly_Hours. Line 1, position 207. I&amp;#39;m so lost.&lt;/p&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&lt;p&gt;// Build a string representing a main DOM workforce nodeset using the values from the secondary DOM.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; workforceXml = &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;lt;d:Weekly_Hours xmlns:d=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;#39;&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;+&amp;nbsp;&amp;quot;&amp;lt;&lt;u&gt;d&lt;/u&gt;:Last_Name&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; + lastname + &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;lt;/&lt;u&gt;d&lt;/u&gt;:Last_Name&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;+&amp;quot;&amp;lt;d:First_Name&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; + firstname + &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;lt;/d:First_Name&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;
+&amp;quot;&amp;lt;d:Position&amp;gt;&amp;quot;&lt;font color="#000000" size="2"&gt; + position + &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;lt;/d:Position&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;+&amp;quot;&amp;lt;d:Status&amp;gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; + position + &lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&amp;lt;/d:Status&amp;gt;&amp;quot;;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;
&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99826.aspx</link><pubDate>Tue, 28 Oct 2014 16:46:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99826</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99826.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99826</wfw:commentRss><description>&lt;p&gt;You were correct XPath should have been (&amp;quot;/dfs:myFields/my:selectedUnit&amp;quot;&amp;nbsp; This update&amp;nbsp;got rid of the error.&amp;nbsp; Thank you so much!&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now during debugging I received a dialog button with the catch exception message &amp;quot;Could not insert other individual--Error message: &amp;#39;d&amp;#39; is an undeclared namespace. Line 1, position 2.&amp;nbsp; Based on what you just said.&amp;nbsp; Could it be that when I am building my main DOM nodeset I dididn&amp;#39;t list the entire XPath there either.&amp;nbsp; I put..&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&lt;p&gt;string workforceXml =&amp;quot;&amp;lt;d:Weekly_Hours xmlns:my=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;#39;&amp;gt;&amp;quot;&lt;p&gt;The XPath for the Weekly_Hours section is /dfs:myFields/dfs:dataFields/d:Weekly_Hours. Do I need to list the entire XPath instead?&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99821.aspx</link><pubDate>Tue, 28 Oct 2014 14:24:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99821</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99821.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99821</wfw:commentRss><description>&lt;p&gt;Generally, this would be because the XPath is incorrect. Did you right click selectedUnit in the data source task pane and select Copy XPath to make sure it was right?&lt;/p&gt;</description></item><item><title>Re: Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99820.aspx</link><pubDate>Tue, 28 Oct 2014 14:18:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99820</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99820.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99820</wfw:commentRss><description>&lt;p&gt;Good Morning,&lt;/p&gt;&lt;p&gt;I really need help with this issue.&amp;nbsp; I still have not been able to locate a solution to my problem.&amp;nbsp; I think maybe I gave too much information and scared off any possible&amp;nbsp;respondants.&amp;nbsp; Bottom line is that I need to create a drop down field and based on that selection, some&amp;nbsp;data fields to my main source will be populated with information from my secondary source.&amp;nbsp; The user will input the remaining.&amp;nbsp; I used some code from Hillary and now I am getting a error: *NullReferenceException error was unhandled by user code* error. Object reference not set to an instance of an object.&amp;nbsp; Here is the code that the error is pointing to &lt;/p&gt;&lt;p&gt;&lt;u&gt;string&lt;/u&gt; &lt;u&gt;selectedUnit&lt;/u&gt; = &lt;u&gt;MainDataSource&lt;/u&gt;.&lt;u&gt;CreateNavigator().SelectSingleNode(&amp;quot;/my&lt;/u&gt;:&lt;u&gt;myFields&lt;/u&gt;/&lt;u&gt;my&lt;/u&gt;:&lt;u&gt;selectedUnit&lt;/u&gt;&amp;quot;, &lt;u&gt;NamespaceManager&lt;/u&gt;).&lt;u&gt;Value&lt;/u&gt;;&lt;/p&gt;&lt;p&gt;I would be truly, truly grateful for any quick assistance.&amp;nbsp; Thank you in advance.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Populate Data Fields in table based on drop-down selection</title><link>https://www.infopathdev.com:443/forums/thread/99620.aspx</link><pubDate>Thu, 16 Oct 2014 14:02:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99620</guid><dc:creator>analystntrg</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99620.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=99620</wfw:commentRss><description>&lt;p&gt;Good Morning,&lt;/p&gt;&lt;p&gt;I am creating an InfoPath form for my supervisors to submit their direct reports&amp;#39; production and hours on a weekly basis. It seems so simple but I have tried now for 2 weeks to find a codeless solution and cannot seem to find any detailed instructions on how to make my form work.&amp;nbsp; &lt;/p&gt;&lt;p&gt;I have approximately 30 work units/departments.&amp;nbsp; I want each supervisor to be able to pull up the form, select their department code from a drop-down list, click a button (&amp;quot;Populate Unit&amp;quot;), and based on that selection in the drop-down&amp;nbsp;field (my:selectedUnit)&amp;nbsp;&amp;nbsp;each employee name within that department(along with other information) will appear in data fields within a repeating table. There will be other data fields next to their names so the supervisor can input the weekly production number and work hours for each employee. Once they fill it out they will submit the form to the main data source, an access table, &amp;quot;Weekly_Hours&amp;quot;. The drop-down list items and employee information are retrieved from a secondary data source: an access table, &amp;quot;Workforce Details&amp;quot;.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt;&lt;p&gt;After trying for days I found some code that Hillary Stoupa posted a few years ago titled &amp;quot;How Do I Copy Repeating Data From an External Source into My Form?&amp;quot; and gave it a try but it didn&amp;#39;t work so&amp;nbsp;I exported my secondary source from a table to an XML (&amp;quot;Workforce&amp;quot;)&amp;nbsp;so it could mirror Hillary&amp;#39;s example. SO CLOSE but&amp;nbsp;there was one error that I am praying you can help me fix. I receive a *NullReferenceException error was unhandled by user code* error. Object reference not set to an instance of an object.&lt;br /&gt;Tips given:&lt;br /&gt;Use the &amp;quot;new&amp;quot; keyword to create an object instance (you may have tried to use an object without using the New keyword first, or tried to use an object whose value is set to null).&lt;br /&gt;Check to determine if the object is null before calling the method.&lt;/p&gt;&lt;p&gt;I am using Infopath 2010. Should my code change somewhat since she used a different year? I tried to provide as much information below as I could :-?&amp;nbsp; Thank you for any help you can provide. This project deadline is quickly approaching.&lt;/p&gt;&lt;p&gt;&lt;u&gt;Schema&lt;/u&gt;&lt;/p&gt;&lt;p&gt;MAIN&lt;/p&gt;&lt;p&gt;myFields&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; queryFields&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; dataFields&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d:Weekly_Hours&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; my:selectedUnit&lt;/p&gt;&lt;p&gt;&lt;u&gt;XML&lt;/u&gt; &lt;u&gt;clip&lt;/u&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;&lt;span class="m"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="pi"&gt;xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; 
&lt;/span&gt;&lt;span class="m"&gt;?&amp;gt;&lt;/span&gt;&lt;/font&gt; 
&lt;/p&gt;&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;" class="c"&gt;&lt;a class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt;-&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Workforce&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;" class="c"&gt;&lt;a class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt;-&lt;/font&gt;&lt;/strong&gt;&lt;/a&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Workforce_x0020_Details&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;ID&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;span class="tx"&gt;&lt;strong&gt;AAA111&lt;/strong&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;ID&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Unit&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;span class="tx"&gt;&lt;strong&gt;MU&lt;/strong&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Unit&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;L_x0020_Name&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;Stackhouse&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;L_x0020_Name&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;F_x0020_Name&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;Sookie&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;F_x0020_Name&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Position&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;span class="tx"&gt;&lt;strong&gt;IN&lt;/strong&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Position&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Supervisor&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;span class="tx"&gt;&lt;strong&gt;A SMITH&lt;/strong&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Supervisor&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Loc&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;BonTemps&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Loc&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div class="e"&gt;
&lt;div style="text-indent:-2em;margin-left:1em;"&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Status&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;span class="tx"&gt;&lt;strong&gt;PT&lt;/strong&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Status&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span class="b"&gt;&lt;strong&gt;&lt;font color="#ff0000" face="Courier New"&gt; &lt;/font&gt;&lt;/strong&gt;&lt;/span&gt; &lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;lt;/&lt;/font&gt;&lt;/span&gt;&lt;span class="t"&gt;&lt;font color="#990000"&gt;Workforce_x0020_Details&lt;/font&gt;&lt;/span&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&lt;/font&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;span class="m"&gt;&lt;font color="#0000ff"&gt;&lt;strong&gt;UNDERLINED CODE IS WHERE NULL REFERENCE EXCEPTION ERROR IS POINTING TO&lt;/strong&gt;&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="m"&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;using Microsoft.Office.InfoPath;&lt;br /&gt;using System;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;using System.Xml;&lt;br /&gt;using System.Xml.XPath;&lt;br /&gt;using mshtml;&lt;/p&gt;&lt;p&gt;namespace test&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public partial class FormCode&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Member variables are not supported in browser-enabled forms.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Instead, write and read these values from the FormState&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // dictionary using code such as the following:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // private object _memberVariable&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return FormState[&amp;quot;_memberVariable&amp;quot;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FormState[&amp;quot;_memberVariable&amp;quot;] = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // NOTE: The following procedure is required by Microsoft InfoPath.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // It can be modified using Microsoft InfoPath.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void InternalStartup()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((ButtonEvent)EventManager.ControlEvents[&amp;quot;cmdPopulateUnit&amp;quot;]).Clicked += new ClickedEventHandler(cmdPopulateUnit_Clicked);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void cmdPopulateUnit_Clicked(object sender, ClickedEventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the selected unit.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;string&lt;/u&gt; &lt;u&gt;selectedUnit&lt;/u&gt; = &lt;u&gt;MainDataSource&lt;/u&gt;.&lt;u&gt;CreateNavigator().SelectSingleNode(&amp;quot;/my&lt;/u&gt;:&lt;u&gt;myFields&lt;/u&gt;/&lt;u&gt;my&lt;/u&gt;:&lt;u&gt;selectedUnit&lt;/u&gt;&amp;quot;, &lt;u&gt;NamespaceManager&lt;/u&gt;).&lt;u&gt;Value&lt;/u&gt;;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If no Unit was selected notify the user.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (selectedUnit.Equals(&amp;quot;&amp;quot;))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(&amp;quot;Please select a Unit first.&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the list of workers per the selected unit.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator Workforce = this.DataSources[&amp;quot;Workforce&amp;quot;].CreateNavigator().Select(&amp;quot;/Workforce/Workforce_x0020_Details[Unit = &amp;#39;&amp;quot; + selectedUnit + &amp;quot;&amp;#39;]&amp;quot;, NamespaceManager);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If nothing was found, then return; there will be no items to insert.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Workforce.Count == 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get the worker insertion point.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator workforceList = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:Weekly_Hours&amp;quot;, NamespaceManager);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add the rows to the main DOM.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (XPathNavigator Workforce_x0020_Details in Workforce)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get this unit&amp;#39;s values from the secondary DOM.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string lastname = Workforce_x0020_Details.SelectSingleNode(&amp;quot;L_x0020_Name&amp;quot;, NamespaceManager).Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string firstname = Workforce_x0020_Details.SelectSingleNode(&amp;quot;F_x0020_Name&amp;quot;, NamespaceManager).Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string position = Workforce_x0020_Details.SelectSingleNode(&amp;quot;Position&amp;quot;, NamespaceManager).Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string status = Workforce_x0020_Details.SelectSingleNode(&amp;quot;Status&amp;quot;, NamespaceManager).Value;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Build a string representing a main DOM vehicle nodeset using the values from the secondary DOM.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string workforceXml = &amp;quot;&amp;lt;d:Weekly_Hours xmlns:my=&amp;#39;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;#39;&amp;gt;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + &amp;quot;&amp;lt;my:Last_Name&amp;gt;&amp;quot; + lastname + &amp;quot;&amp;lt;&lt;a&gt;/@Last_Name&lt;/a&gt;&amp;gt;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + &amp;quot;&amp;lt;my:First_Name&amp;gt;&amp;quot; + firstname + &amp;quot;&amp;lt;&lt;a&gt;/@First_Name&lt;/a&gt;&amp;gt;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + &amp;quot;&amp;lt;my:Position&amp;gt;&amp;quot; + position + &amp;quot;&amp;lt;&lt;a&gt;/@Position&lt;/a&gt;&amp;gt;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + &amp;quot;&amp;lt;my:Status&amp;gt;&amp;quot; + status + &amp;quot;&amp;lt;&lt;a&gt;/@Status&lt;/a&gt;&amp;gt;&amp;quot;;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Load new workforce string into a temporary XML document&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XmlDocument tempDoc = new XmlDocument();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tempDoc.LoadXml(workforceXml);&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Insert the new record into the main DOM.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNavigator newWorker = tempDoc.CreateNavigator().SelectSingleNode(&amp;quot;d:Weekly_Hours&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; workforceList.AppendChild(newWorker);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(&amp;quot;Could not insert other individual.\n\nError message:\n&amp;quot; + ex.Message);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>