Age calculation

F

Fantomegl

Is there a way in Word2000 to calculate the age of a person based upon
REF'd date-of-birth entry in a online form
 
F

Fantomegl

Graham, Thanks for the link but I am still unable to figure out how to
calculate the age of a subject based on a DOB entry in a form and
todays date.

My form fields are "today" (the current date) and "dob" (the date of
birth).

All I need to calculate is years.

Thanks,
Robert
The Dense One
 
G

Graham Mayor

The section you are looking for is on page 13 - Interactively Calculate A
Person's Age
This includes a field construction that will build the age from the date of
birth and the current date (or an input date). It is better to copy the
field from the document to the place where you want the age to appear,
rather than to try and reconstruct it from here (you cannot paste fields
from plain text messages). You would then modify the fields to work with
your formfield bookmark names i.e. dob and Today as below.

{QUOTE
{SET by {REF dob \@ yyyy}}
{SET bm { REF dob \@ M}}
{SET bd { REF dob \@ d}}
{SET yy {REF Today \@ yyyy}}
{SET mm {REF Today \@ M}}
{SET dd {REF Today \@ 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}}
"{Years} Year{IF{Years}= 1 "" s}"}


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
F

Fantomegl

Graham I can't thank you enough!

My forms are now working great!

I simplified the construction for my form to just calculate years of
age which is all I needed for my purposes. Here is the result.

{QUOTE
{SET by {REF dob \@ yyyy}}
{SET bm { REF dob \@ M}}
{SET bd { REF dob \@ d}}
{SET yy {REF Today \@ yyyy}}
{SET mm {REF Today \@ M}}
{SET dd {REF Today \@ d}}
{Set Years{=yy-by-(mm<bm)-(mm=bm)*(dd<bd) \# 0}}
"{Years} Year{IF{Years}= 1 "" s}"}

dob=date-of-birth form field bookmark
Today=today's currentdate form field bookmark

Thanks again,
Robert
 

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