Populating one field from another, after update.

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top