<?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: Creating a new record from an existing record</title><link>https://www.infopathdev.com:443/forums/thread/55787.aspx</link><pubDate>Thu, 10 Jun 2010 20:06:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55787</guid><dc:creator>Joemanc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55787.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=55787</wfw:commentRss><description>&lt;p&gt;My solution may not work for everyone, and it may not be the most elegant, but it works.&amp;nbsp;Here goes...&lt;/p&gt;
&lt;p&gt;Under a Duplicate button,&amp;nbsp;I&amp;nbsp;used SQL insert statements to copy each&amp;nbsp;record&amp;nbsp;I wanted to duplicate as a new one within code(see code below). Since I have multiple tables, I had to use an insert statement for each table. You&amp;#39;ll also need to be aware of your primary keys when copying record(s) for each table. After I did the 1st insert, I did a query and retrieved the highest ID in that 1st table and stored this in a variable(see code).&amp;nbsp;Once the&amp;nbsp;records are copied for each table, I cleared out all the fields(see code below). Then, using the max ID in the stored variable, I queried using my Main Data Connection and used the stored ID in the variable.&lt;/p&gt;
&lt;p&gt;&amp;#39;sql statement&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;strsql = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;insert into assig(sysid, dmod, modby,&amp;nbsp;spltamt) select &amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; lastsysid &amp;amp; &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;, &amp;#39;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; Now &amp;amp; &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;&amp;#39;, modby,&amp;nbsp;spltamt from assign where sysid = &amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &amp;amp; SysIDNumber.ToString&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;&amp;nbsp;&amp;#39;retrieve max ID&lt;/p&gt;&lt;font size="2"&gt;
&lt;p&gt;strsql = &lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;select max(sysid) as sysid from clntmtr&amp;quot;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;#39;clear out all fields&amp;nbsp;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;MainDataSource.CreateNavigator().SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;/dfs:myFields/dfs:dataFields&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager).ReplaceSelf(initialData)&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Creating a new record from an existing record</title><link>https://www.infopathdev.com:443/forums/thread/55431.aspx</link><pubDate>Fri, 28 May 2010 19:28:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55431</guid><dc:creator>jose cruz</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55431.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=55431</wfw:commentRss><description>&lt;p&gt;Hi Joemanc,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I am not sure if you have used DBXL before, if yes, there is a Side-by-side XTP that you can use for your existing Save or Submit button. You just need to clear the Key fields so that when you click the Save or Submit button, the information will be treated as a new form.&lt;/p&gt;
&lt;p&gt;Hope the above helps.&lt;/p&gt;</description></item><item><title>Creating a new record from an existing record</title><link>https://www.infopathdev.com:443/forums/thread/55421.aspx</link><pubDate>Fri, 28 May 2010 17:27:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:55421</guid><dc:creator>Joemanc</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/55421.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=55421</wfw:commentRss><description>&lt;p&gt;In Infopath, I&amp;#39;m trying to create a copy, or duplicate,&amp;nbsp;of a record on one of my Infopath form&amp;#39;s, so that when the user makes changes to the&amp;nbsp;data shown on the form and then goes to save, a new record is added to the database.&lt;/p&gt;
&lt;p&gt;I tried to query using an ADODataConnection, and then in code setting the Primary Key ID to 0, and then using a me.submit&amp;nbsp;command to see if that would try to save the record&amp;nbsp;and re-issue the next unique Primary Key, but I got an error message.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see any other options off of the me.submit command. I&amp;#39;m not sure where to look or to start for that matter.&lt;/p&gt;
&lt;p&gt;Anyone have any ideas? Thanks.&lt;/p&gt;</description></item></channel></rss>