Re: Calculating age, given DOB & current date



In microsoft.public.access.forms on Sun, 19 Feb 2006, Paul Hyett wrote :

DateDiff("yyyy", [DOB], Date()) - _
IIf(Format(Date(), "mmdd") < Format([DOB], "mmdd"), 1, 0)

Your options are to create a query, and add the Age calculation as a
computed field in the query, or use it as the Control Source for a text box
on your form.

I don't know how to do the latter, so I'll experiment with the former.

Yes, that was just want I wanted - thanks again.
--
Paul 'Charts Fan' Hyett
.



Relevant Pages

  • Re: Nested IIF Statements
    ... I generally prefer to have expressions in a query rather than in the ... expression is in the control source rather than in the query. ... Yes, my form is based on a table and Sales, Short, and Long are fields ... Or maybe you would need to use the Nz function, as the calculation ...
    (microsoft.public.access.forms)
  • Re: Changing the parameters of a form
    ... need to store the Working Days. ... the query should return what you want. ... I am using the form so that a user can simply select a StartDate and EndDate ... just put Available in the Control Source text box. ...
    (microsoft.public.access.queries)
  • Re: Changing the parameters of a form
    ... the query should return what you want. ... I am using the form so that a user can simply select a StartDate and EndDate ... a forms record source is the table or query that the form is ... just put Available in the Control Source text box. ...
    (microsoft.public.access.queries)
  • Re: Records not adding...Please help!
    ... When I say Control source = master Item ... other text boxes are automatically populated. ... Row souce in properties is called operator query ... Private Sub Category_AfterUpdate ...
    (microsoft.public.access.forms)
  • Re: Nested IIF Statements
    ... build the report. ... Name from the Query. ... box and get an Invalid Control Source and Circular Reference message when I ... Or maybe you would need to use the Nz function, as the calculation ...
    (microsoft.public.access.forms)