Calculating Age

  • Thread starter Thread starter PawleysGrits
  • Start date Start date
P

PawleysGrits

Using Access 2003, & WIN XP-Pro. In a table, I have an employee's birth
date, defined as dd-mmm-yyy. In a form, I would like to calculate the age
of the employee, and such is done with

=DateDiff("yyyy",[Birthdate],Now())+Int(Format(Now(),"mmdd")<Format([Birthda
te],"mmdd"))"

The problem is that each time I open the form, the age calculation
evaporates - it will work one time, and not another, with absolutely NO
changes being made to the form or table design. This isn't the only thing
that works sporadically; a control to create the employee name (from
separate first and last name fields) in a form page header comes and goes at
will.

I would appreciate any suggestions, and thanks in advance!
 
Using Access 2003, & WIN XP-Pro. In a table, I have an employee's birth
date, defined as dd-mmm-yyy. In a form, I would like to calculate the age
of the employee, and such is done with

=DateDiff("yyyy",[Birthdate],Now())+Int(Format(Now(),"mmdd")<Format([Birthda
te],"mmdd"))"

The problem is that each time I open the form, the age calculation
evaporates - it will work one time, and not another, with absolutely NO
changes being made to the form or table design. This isn't the only thing
that works sporadically; a control to create the employee name (from
separate first and last name fields) in a form page header comes and goes at
will.

I would appreciate any suggestions, and thanks in advance!

What's the Form's Recordsource? Does it include the [Birthdate] field,
and is that field in fact a non-null Date/Time field?

If that's all correct, I suspect the Form may be corrupt. Have you
tried Tools... Database Utilities... Compact and Repair? YOu may also
want to try creating a new (simple, stripped down, with just the
Birthdate and calculated Age controls) form to be sure that the data
is in fact there and correct.

John W. Vinson[MVP]
(no longer chatting for now)
 
Your suggestion to create another form containing only the calculated
controls worked, and that inspired me to trash the errant form and start
over. Happily, the problem is solved. Thank you for your assistance.

John Vinson said:
Using Access 2003, & WIN XP-Pro. In a table, I have an employee's birth
date, defined as dd-mmm-yyy. In a form, I would like to calculate the age
of the employee, and such is done with

=DateDiff("yyyy",[Birthdate],Now())+Int(Format(Now(),"mmdd")<Format([Birthd
a
te],"mmdd"))"

The problem is that each time I open the form, the age calculation
evaporates - it will work one time, and not another, with absolutely NO
changes being made to the form or table design. This isn't the only thing
that works sporadically; a control to create the employee name (from
separate first and last name fields) in a form page header comes and goes at
will.

I would appreciate any suggestions, and thanks in advance!

What's the Form's Recordsource? Does it include the [Birthdate] field,
and is that field in fact a non-null Date/Time field?

If that's all correct, I suspect the Form may be corrupt. Have you
tried Tools... Database Utilities... Compact and Repair? YOu may also
want to try creating a new (simple, stripped down, with just the
Birthdate and calculated Age controls) form to be sure that the data
is in fact there and correct.

John W. Vinson[MVP]
(no longer chatting for now)
 
Back
Top