Hi i'm new to VBScript in Infopath 03, so sorry if this I sound like an idiot.
I'm trying to set a Start Date and an End Date based on Todays Date, its worth mentioning now i'm from the UK, so the day and month are the other way round. I want the start and end date to be between 01.04.*year* and 31.03.*year +1*
So for example if todays date was 12.12.09, the start and dates would be worked out as 01.04.2009 and 31.03.2010.
Also if todays date is 24.02.2010, the start and dates would still be 01.04.2009 and 31.03.2010. Hopefully thats easy enough to understand.
todays date is worked using the date() function by the Open Behaviour rules in Form Options, so it will always have the current date when the form is opened - "DD/MM/YYYY". No date picker is used.
Heres, the code i've managed so far, any help on this would be very much appreciated
XDocument.DOM.setProperty "SelectionNamespaces", "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:d=""http://schemas.microsoft.com/office/infopath/2003/ado/dataFields"" xmlns:dfs=""http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"" xmlns:xdEnvironment=""http://schemas.microsoft.com/office/infopath/2006/xslt/environment"" xmlns:xdUser=""http://schemas.microsoft.com/office/infopath/2006/xslt/User"" xmlns:xsf2=""http://schemas.microsoft.com/office/infopath/2006/solutionDefinition/extensions"" xmlns:xhtml=""http://www.w3.org/1999/xhtml"" xmlns:tns=""http://tempuri.org/"" xmlns:mime=""http://schemas.xmlsoap.org/wsdl/mime/"" xmlns:tm=""http://microsoft.com/wsdl/mime/textMatching/"" xmlns:soapenc=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:soap=""http://schemas.xmlsoap.org/wsdl/soap/"" xmlns:http=""http://schemas.xmlsoap.org/wsdl/http/"" xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/"" xmlns:my=""http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-02-16T14:02:17"" xmlns:xd=""http://schemas.microsoft.com/office/infopath/2003""" ' '======= ' The following function handler is created by Microsoft Office InfoPath. ' Do not modify the name of the function, or the name and number of arguments. '=======
Dim dtToday, dtStart, dtEnd
Dim dtYear, dtMonth, dtDay
Sub XDocument_OnLoad(eventObj)
dtToday = XDocument.DOM.selectSingleNode("my:myFields/my:dtToday").Text
'Code Here
'XDocument.DOM.selectSingleNode("my:myFields/my:dtStart").Text = dtStart
'XDocument.DOM.selectSingleNode("my:myFields/my:dtEnd").Text = dtEnd
End Sub