Calculated date fields are quite complex and do not need vba (though you can
certainly achieve the same ends with vba). If you want to calculate an age
from a DOB field using fields then the construction would be:
{QUOTE
{ASK BirthDate "What is the Birthdate?"}
{SET by {BirthDate \@ yyyy}}
{SET bm {BirthDate \@ M}}
{SET bd {BirthDate \@ d}}
{SET yy {DATE \@ yyyy}}
{SET mm {DATE \@ M}}
{SET dd {DATE \@ d}}
{SET
md{=IF((mm=2),28+(mm=2)*((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0)),31-((mm=4)+(mm=6)+(mm=9)+(mm=11)))}}
{Set Years{=yy-by-(mm<bm)-(mm=bm)*(dd<bd) \# 0}}
{Set Months{=MOD(12+mm-bm-(dd<bd),12) \# 0}}
{Set Days{=MOD(md+dd-bd,md) \# 0}}
{IF{={IF{={BirthDate \@ "dddd"}}= "!*" 0 1}+{IF{={BirthDate \@ "MMMM"}}=
"!*" 0 1}+{ IF{ by }= "!*" 1 0 }+{IF{BirthDate \@ yyyyMMdd}<{DATE \@
yyyyMMdd} 0 1}}= 0 "If your Date of Birth was {Birthdate \@ "d MMMM yyyy"},
then your age is {Years} Year{IF{Years}= 1 "" s}, {Months} Month{IF{Months}=
1 "" s} and {Days} Day{IF{Days}= 1 "" s}." "Data entry error!"}}
To avoid errors in reproducing this, you can copy the construction from
Macropods excellent article on date fields which you can download from
http://www.gmayor.com/downloads.htm#Third_party
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>