In a mailmerge doc, I have {MERGEFIELD DateOfLoss}. I do not want the
merged doc to print the DateOfLoss: I want it to print the date 2 years and
1 day AFTER the DateOfLoss. :-)
Any takers?
Hi Kathy,
To do this you could code your field as:
{QUOTE
{SET MDate {MERGEFIELD DateOfLoss}}
{SET a{=INT((14-{MDate \@ M})/12)}}
{SET b{={MDate \@ yyyy}+4802-a}}
{SET c{={MDate \@ M}+12*a-3}}
{SET d{MDate \@ d}}
{SET jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32044}}
{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}-{mm}-{yy}" \@ "dddd, d MMMM yyyy"}
Rather than creating all this yourself, you can download my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902
and modify the example under 'Calculate a day, date, month and year, using n days delay' to suit.
The key changes are:
. change {SET Delay 14}to {SET MDate {MERGEFIELD DateOfLoss}}
. change all 'DATE' strings to 'MDate'
. change '4800' on the 4th line to '4802'
. change '32045+Delay' on the 7th line to '32044'
Cheers

Signature
macropod
[MVP - Microsoft Word]
-------------------------
> In a mailmerge doc, I have {MERGEFIELD DateOfLoss}. I do not want the
> merged doc to print the DateOfLoss: I want it to print the date 2 years and
> 1 day AFTER the DateOfLoss. :-)
> Any takers?
Kathy Webster - 24 Apr 2007 20:53 GMT
Yee-hikes! Thank you for doing the heavy lifting!
xxoo
> Hi Kathy,
>
[quoted text clipped - 33 lines]
>> and 1 day AFTER the DateOfLoss. :-)
>> Any takers?
macropod's solution is just fine, but if your data source is something like
Access you can also consider using a query to give the right date, which may
help keep the complexity of your Word documents down.
Peter Jamieson
> In a mailmerge doc, I have {MERGEFIELD DateOfLoss}. I do not want the
> merged doc to print the DateOfLoss: I want it to print the date 2 years
> and 1 day AFTER the DateOfLoss. :-)
> Any takers?
Kathy Webster - 24 Apr 2007 20:50 GMT
Thank you. There are so many different requirements for different date
scenarios. That's why I need to address the issue in Word rather than in my
access data source. I would love to have Access handle it, since I know
what I'm doing there! :-) Unfortunately, I need to build my Word chops.
> macropod's solution is just fine, but if your data source is something
> like Access you can also consider using a query to give the right date,
[quoted text clipped - 5 lines]
>> and 1 day AFTER the DateOfLoss. :-)
>> Any takers?
Peter Jamieson - 24 Apr 2007 23:41 GMT
> I would love to have Access handle it, since I know what I'm doing there!
> :-)
:-) Well, you're probably better off following your existing approach, but
if you really prefer Access/Jet/VBA-style date calculations, see
http://tips.pjmsn.me.uk/t0004.htm
Peter Jamieson
> Thank you. There are so many different requirements for different date
> scenarios. That's why I need to address the issue in Word rather than in
[quoted text clipped - 11 lines]
>>> and 1 day AFTER the DateOfLoss. :-)
>>> Any takers?