Calculating someones age

datamismatch

Registered User.
Local time
Today, 18:50
Joined
Feb 1, 2004
Messages
13
I am using Access 97

In a table of members I have recorded a date of birth (DOB) displayed in the format 99/99/9999. Can someone tell me how I can calculate someones age from this field.

Thanks
 
Thanks for that, I did actually find the link that you directed me to but I get a syntax error message when I run the query
 
The expression you entered contains invalid syntax.
You omitted an operand or operator, you entered an invalid comma or character, or you entered text without surrounding it in quotation marks.
 
Age=DateDiff("yyyy", [DOB], Now())+ _ Int( Format(now(), "mmdd") < Format( [DOB], "mmdd") )
 
Take out the underscore - that's used for run-on lines as evidenced in the example given.
 
Thanks for that, I have a lot to learn, Really appreciate your help
 
I'd also substitute the Now() function for the Date() function - Now() is too much information when all you essentially need to check is the date and not the time down to the nearest second.
 
calculating someones age

Thats working great, thanks for your help all I have to do now is work out how to feed it back into the table so I'll have a look through the forum I'm sure others will have had the same problem
Thanks again, I really appreciate it.
 
Re: calculating someones age

datamismatch said:
all I have to do now is work out how to feed it back into the table
NO!

You alread have the date of birth. You don't need to store the age whatsoever. This would violate Third Normal Form (3NF) as you shouldn't have calculated values within your tables.

Always use queries, forms, reports to do your calculations at runtime.
 
calculating someones age

Yes I just found that out from doing a bit of reading. Tis a form that I new to display it in. Thanks for keeping an eye on me.
 

Users who are viewing this thread

Back
Top Bottom