I still need help, in my form I have a date of birth field, what I still need is a module that will give me how old a person is in years, months and days. all help welcome.
TIA Marty
I still need help, in my form I have a date of birth field, what I still need is a module that will give me how old a person is in years, months and days. all help welcome.
TIA Marty
before we can get the answer, we must clairify this:
if now is 11/10/2010, birthday is 5/11/2010, so the year is 0, month is 5, what is the day, 30 or 29?
that does not work, I dont nknow why. I typed the field as you suggest, but aftert hitting the enter key, I get Expr1: [howold]=Format(Now()-[BirthDate],"yy-mm-dd")
Than when I goto view it asked for Parameter value.
I edit my post. something needs clarification.
Following function returns the year,month and day,
but may be inaccurate by one day. for example, today is 11/10/2010, if birthday is 10/11/2010, it return 0 - 0 - 29, however, it should be 30 days.
Code:Function howOld(birthday As Date) As String 'reutrn yy-mm-dd Dim dd, mm, yy dd = Day(Now) - Day(birthday) mm = 0 yy = 0 If dd < 0 Then dd = dd + 30 mm = -1 End If mm = mm + Month(Now) - Month(birthday) If mm < 0 Then mm = mm + 12 yy = -1 End If yy = yy + Year(Now) - Year(birthday) howOld = yy & "-" & mm & "-" & dd End Function