February 16, 200421 yr Hi all I am trying to write a script that will find a specific date depending on the current month. If it is October, November or December I want the find in the script to the 1st October and the current year. If it is the rest of the year I want it to find 1st October and the previous year. My script is currently Enter Find Mode If(month(Today) >= 10 Set Field(Date Of Leaving,TextToDate("<1/10/" &Year(Today)) Else Set Field(Date Of Leaving,TextToDate("<1/10/" & Year(Today) - 1) End If Perform Find What am I doing wrong??? Please Help Thanks
February 16, 200421 yr I think you're missing some brackets. After your "else" try: Set Field(Date Of Leaving,TextToDate("<1/10/" & (Year(Today) - 1)) note the extra brackets around (Year(Today) - 1)
February 16, 200421 yr ...And make sure the date field you are calculating is on the current layout when the script executes.
February 16, 200421 yr ... and use Status(CurrentDate) not the TODAY function. I just noticed the TextToDate() function in there. TextToDate will break if the solution is used on a machine set to a different date format (eg, Australian instead of US). Use Date() instead. So, putting it all together... Insert Calculated Result [Date Of Leaving, "<" & DateToText(Date(1, 10, (Year(Status(CurrentDate)) - 1))]
February 18, 200421 yr Author Thanks everyone I managed to overcome that problem........much appreciated
Create an account or sign in to comment