Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi,
I have been asked to produce a letter in mail merge that has a response due date within it (2 weeks from day of printing), unfortunately the database that I am using I cannot calculate it and add it as a new field as I cannot change the date within it. Is there any way to calculate a date based on the SentDate field that I can pull through and add 2 weeks to it? I have tried the following two codes but neither quite work This gives me 07-00-2016 {QUOTE{SET Delay 14}{SET a{=INT((14-{MERGEFIELD DATEFIELD \@ M})/12)}}{SET b{={MERGEFIELD DATEFIELD \@ yyyy}+4800-a}}{SET c{={MERGEFIELD DATEFIELD \@ M}+12*a-3}}{SET d{MERGEFIELD DATEFIELD \@ d}}{SET jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}{SET e{=INT((4*(jd+32044)+3)/146097)}}{SET f{=jd+32044-INT(146097*e/4)}}{SET g{=INT((4*f+3)/1461)}}{SET h{=f-INT(1461*g/4)}}{SET i{=INT((5*h+2)/153)}}{SET dd{=h-INT((153*i+2)/5)+1}}{SET mm{=i+3-12*INT(i/10)}}{SET yy{=100*e+g-4800+INT(i/10)}}{=dd*10^6+mm*10^4+yy \# "00'-'00'-'0000"} \@ "dddd, d MMMM yyyy"} This gives me August 38 2016 { QUOTE "{ SET " Delay" "14" } { SET "DaysInMonth" { IF { CreateDate \@ "MM" } 2 { = ROUND(30.575*{ CreateDate \@ "MM" },0)- ROUND(30.575*{ = { CreateDate \@ "MM" } -1 },0) } { IF { = MOD( { CreateDate \@"yy" } , 4 ) } 0 "28" "29" } } } { SET "NextMonth" { IF { CreateDate \@ "MM" } = 12 "1/97" "{ = { CreateDate \@ "MM" } + 1 }/97 } } { IF { = { REF "Delay" } + { CreateDate \@ "dd" } } = { REF"DaysInMonth" } { CreateDate \@ "MMMM { = { REF "Delay" } + { CreateDate \@ "dd" } }, yyyy"}{ QUOTE { NextMonth \@ "MMMM" } { = { REF "Delay" } + { CreateDate \@ "dd" } - { REF"DaysInMonth" } }, { IF { CreateDate \@ "MM" } 12 { CreateDate \@ "yyyy" } { CreateDate \@ "{ = 1 + { CreateDate \@ "yyyy" } \# "xxxx" }" } } } }" } Anyone spot the problem with either of them? TIA Emma Last edited by emismile : August 24th 16 at 12:12 PM Reason: extra info |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Future merge field dates | Mailmerge | |||
Future Dates - Again! | Mailmerge | |||
Can Word automatically send reminders on specific future dates | Microsoft Word Help | |||
Entering fields for future dates? | Microsoft Word Help | |||
How to calculate Future Dates? | Microsoft Word Help |