<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Infopath 2003</title><link>https://www.infopathdev.com:443/forums/thread/33921.aspx</link><pubDate>Thu, 06 Nov 2008 02:00:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33921</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33921.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=33921</wfw:commentRss><description>&lt;p&gt;Okay. First you&amp;#39;ll need to set your form&amp;#39;s programming language to VBScript. I don&amp;#39;t remember exactly where that is in IP2003 -- in 2007, it is under &lt;strong&gt;Tools/Form Options/Programming&lt;/strong&gt;. You can right click the date field your user is entering their start date, and in the context menu, under &lt;strong&gt;Programming&lt;/strong&gt;, select the On After Change event. This will add the event to your form and open the script editor.&lt;/p&gt;
&lt;p&gt;The sample code gets the difference between two dates that are entered in the form and enters the days between the dates in a text box. To do what you need, the script would look more like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Dim start&lt;br /&gt;Dim startDate &lt;br /&gt;Dim diff &lt;br /&gt;Set start = XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:field1&amp;quot;) &lt;br /&gt;&lt;br /&gt;If start.text = &amp;quot;&amp;quot; Then &lt;br /&gt;&amp;nbsp;&amp;nbsp; Exit Sub &lt;br /&gt;End If &lt;br /&gt;&lt;br /&gt;startDate = CDate(start.text) &lt;br /&gt;diff = DateDiff(&amp;quot;d&amp;quot;, startDate, Date) XDocument.DOM.selectSingleNode(&amp;quot;/my:myFields/my:field2&amp;quot;).text = diff &lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This VBScript gets the number of days between today and a field (field1) in the form, then returns that value in field2 in the same form. To get years and days, you&amp;#39;ll need to divide diff by 365 for the years, and then get the remainder for days.... Hope this helps!&lt;/p&gt;</description></item><item><title>Re: Infopath 2003</title><link>https://www.infopathdev.com:443/forums/thread/33919.aspx</link><pubDate>Wed, 05 Nov 2008 20:11:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33919</guid><dc:creator>Scotl</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33919.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=33919</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am providing a calculation form for my staff. It allows them to find where they stand in a selection process for offices.&lt;/p&gt;
&lt;p&gt;I need to calculate their time of service.&lt;/p&gt;
&lt;p&gt;I am hoping to find a formula where I can take the Current Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#39;today()&amp;#39;&amp;nbsp;&amp;nbsp;&amp;nbsp; when using InfoPath 2003 functions&amp;nbsp;&amp;nbsp; and subtract a date&amp;nbsp; in which they would enter in one field.&lt;/p&gt;
&lt;p&gt;I need to take the difference and display the Years and days&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Infopath 2003</title><link>https://www.infopathdev.com:443/forums/thread/33916.aspx</link><pubDate>Wed, 05 Nov 2008 19:26:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33916</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33916.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=33916</wfw:commentRss><description>&lt;p&gt;Well, if you are using IP 2003 and are not using Visual Studio, you&amp;#39;ll need to use JScript or VBScript. Code goes into form events, so you need to add an event to the field or action that should trigger the date calculation. Can you provide some more information about the types of date calculations you need to do?&lt;/p&gt;</description></item><item><title>Re: Infopath 2003</title><link>https://www.infopathdev.com:443/forums/thread/33913.aspx</link><pubDate>Wed, 05 Nov 2008 17:52:59 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33913</guid><dc:creator>Scotl</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33913.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=33913</wfw:commentRss><description>&lt;p&gt;Hilary,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Thanks for access to the template.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I will use whatever is best to get the job complete. All the codes go in the Fx section of the formula placement section in InfoPath 2003, correct?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I was told that several formulas for subtracting dates were not possible until 2007.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Jeff&lt;/p&gt;</description></item><item><title>Re: Infopath 2003</title><link>https://www.infopathdev.com:443/forums/thread/33906.aspx</link><pubDate>Wed, 05 Nov 2008 15:39:03 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33906</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33906.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=33906</wfw:commentRss><description>&lt;p&gt;Hi, and welcome!&lt;/p&gt;
&lt;p&gt;I created a 2003 version of a template I made with some samples to get the days, months and years using rules. You can find that &lt;a href="http://www.infopathdev.com/files/folders/basics/entry33905.aspx"&gt;here&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;As far as date math, in IP 2003, you&amp;#39;ll need to use code for that. Are you using script or managed code?&lt;/p&gt;</description></item><item><title>Infopath 2003</title><link>https://www.infopathdev.com:443/forums/thread/33904.aspx</link><pubDate>Wed, 05 Nov 2008 15:24:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:33904</guid><dc:creator>Scotl</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/33904.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=33904</wfw:commentRss><description>&lt;p&gt;I am a newbie, self teaching my self the basics for creating form and codes&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What are the codes for days, months, years?&lt;/p&gt;
&lt;p&gt;How can I subtract on day from the current date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Today()&lt;/p&gt;
&lt;p&gt;How can I find the difference between&amp;nbsp;&amp;nbsp;&amp;nbsp; Today ()&amp;nbsp; and a date that is entered into a field by a user?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>