View Full Version : Age Calculation will not show up on my table


Pasadena
01-27-2001, 01:37 AM
I have a form with DOB and AGE. I have it to where age is automatically calculated by what the DOB is entered; however, the age is not put into the table. It keeps the age on the form but not onto the table. Im using A2K and the following to calculate age:

=IIf(((DatePart("m",Date())=DatePart("m",[DOB])) And (DatePart("d",Date())=DatePart("d",[DOB]))) Or (DatePart("m",Date())>DatePart("m",[DOB])) Or (DatePart("m",Date())=DatePart("m",[DOB]) And DatePart("d",Date())>DatePart("d",[DOB])),DateDiff("yyyy",[DOB],Date()),DateDiff("yyyy",[DOB],Date())-1)

I placed the above in the control source for age. DOB and Age are on the same table.
How can I make it show the value on the table?

Thank you for any response!

russi
03-08-2001, 05:34 AM
Understand that i am using Access97. But that said, I did the following too store age in table as I needed to. If this seems unclear let me know and I will try to re-explain.

In my table I have a field called APPLICATION_DATE, one called BIRTH_DATE, and one called AGE_AT_APPLICATION. The 'date' fields are short date, and the Age-At_Application is a number (field size Long Integer and format General Number).

On my form, I ask APPLIACTION_DATE. Later, DATE_OF_BIRTH. Next to this field I put a text box called AgeCalculation whose Control Source is

=DateDiff("yyyy",[BIRTH_DATE],[APPLICATION_DATE])

The next field with Visible set to NO is AGE_AT_APPLICATION.

And that's it!