Calculating customer AGE

  • Thread starter Thread starter Paul Hamel via AccessMonster.com
  • Start date Start date
P

Paul Hamel via AccessMonster.com

I wanted to have a text box in my FORM which will calculate the AGE of the
customer by using the Birthdate and displaying it on the form. How and
where do i do that?

Thank you.
 
Could you please tell me where to insert that code?

Age=DateDiff("yyyy", [Bdate], Now())+ _
Int( Format(now(), "mmdd") < Format( [Bdate], "mmdd") )

Thanks.
 
Paul,

You mentioned you want this on a form. Put an unbound textbox on the
form, and in the Control Source property of the textbox enter the
calculation expression. If your date of birth field is called
Birthdate, the expression could be like this...

=DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(),"mmdd"))
 
Paul said:
Could you please tell me where to insert that code?

Age=DateDiff("yyyy", [Bdate], Now())+ _
Int( Format(now(), "mmdd") < Format( [Bdate], "mmdd") )

Just put that in as the control source of an unbound textbox on your form
(without the Age at the beginning) - from the = on.
 
Back
Top