Adding a year to a date field

S

Sharon

In my database I have a field for a filing date. I need
to add one year to that date automatically and populate a
field in my Word document.

Thanks.
 
P

Peter Jamieson

Ideally, do the addition in a query or view in your database - this is
technically possible in e.g. Access, but you may not have permission to do
it.

Otherwise, you can try the following nested fields for this one:

{ QUOTE "{ SET Y { = { MERGEFIELD mydate \@YYYY } + 1 }
}{ SET M { MERGEFIELD mydate \@MM }
}{ SET D { MERGEFIELD mydate \@DD }
}{ IF { REF M } = "02"
"{ IF { REF D } = "29" "{ SET M "03" }{ SET D "01" }" "" }" ""
}{ REF Y }-{ REF M }-{ REF D}" \@"MMM DD, YYYY" }

All the {} need to be the special field codes you can enter using ctrl-F9.
substitute your date file name for "mydate", and substitute the date format
specification you need instead of "MMM DD, YYY"

If you need a more general-purpose routine for manipulating dates using Word
fields (and even if you don't it's probably worth checking out), I suggest
you head for macropod's excellent resource at

http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top