Populating one field from another, after update.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database with a field RenterDOB for the user to put in the Date of
Birth, then I have another field for RenterAge. I want to be able to have the
RenterAge to be calculated automatically after the user puts in the
RenterDOB.

I know I want this is be AfterUpdate, how do I write the code for the one
field to populate the other? Someone gave me the following code to try, but I
am having a brain cramp with how to get one field to populate the other.

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

Suggestions, thoughts and code are appreciated! m.
 
First, don't store the age in another field in the table.
You can always use a query to get the age of a person, without maintaining
this field.

In the text box that display the age, write in the ControlSource

= DateDiff("yyyy", [DOB], Now()) + Int(Format(Now(), "mmdd") < Format([DOB],
"mmdd"))

It will display the Age Automatically as you update the date of birth
 
Back
Top