<?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>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Save using custom code question</title><link>https://www.infopathdev.com:443/forums/thread/52363.aspx</link><pubDate>Wed, 03 Mar 2010 00:34:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52363</guid><dc:creator>dc330</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52363.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=52363</wfw:commentRss><description>&lt;p&gt;Found the correct code for the flname = statement: &lt;/p&gt;
&lt;p&gt;flname = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:TimeTable/@ID&amp;quot;, NamespaceManager).Value &lt;/p&gt;
&lt;p&gt;Thanks to anyone who was looking at this for me. &lt;/p&gt;</description></item><item><title>Save using custom code question</title><link>https://www.infopathdev.com:443/forums/thread/52341.aspx</link><pubDate>Tue, 02 Mar 2010 16:36:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:52341</guid><dc:creator>dc330</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/52341.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=52341</wfw:commentRss><description>&lt;p&gt;Hello, I want to add custom code (VB) to my Access database connected form which will generate a filename and path when the user clicks Save. I&amp;#39;ve added the following code to the save behaviour but I&amp;#39;m having trouble figuring out the syntax to pull data out of fields on the form. This is my code: &lt;/p&gt;
&lt;p&gt;Public Sub FormEvents_Save(ByVal sender As Object, ByVal e As SaveEventArgs) &lt;br /&gt;&amp;nbsp;&amp;nbsp; Dim flname As String &lt;br /&gt;&amp;nbsp;&amp;nbsp; flname = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/myFields/dataFields/TimeTable/ID&amp;quot;).ToString&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; Me.SetSaveAsDialogFilename(flname) &lt;br /&gt;&amp;nbsp;&amp;nbsp; Me.SetSaveAsDialogLocation(&amp;quot;g:\!workgrp\tenures\tenuretracking\savedforms&amp;quot;) &lt;br /&gt;&amp;nbsp;&amp;nbsp; e.PerformSaveOperation() &lt;br /&gt;&amp;nbsp;&amp;nbsp; e.CancelableArgs.Cancel = False &lt;br /&gt;End Sub &lt;br /&gt;&lt;br /&gt;It works if I comment out the flname = statement. This is the error I get: &lt;br /&gt;&lt;br /&gt;System.NullReferenceException &lt;br /&gt;Object reference not set to an instance of an object. &lt;br /&gt;&amp;nbsp;&amp;nbsp; at Road_Permit_Amendment.FormCode.FormEvents_Save(Object sender, SaveEventArgs e) &lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnSaveRequest(SaveEvent pEvent) &lt;br /&gt;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSaveRequest(SaveEvent pEvent) &lt;br /&gt;&lt;br /&gt;Can someone please tell me what I&amp;#39;m doing wrong? &lt;/p&gt;</description></item></channel></rss>