Format a number in a calculated field

P

PeterK

I have a table with personal client information. One field shows date of
birth; the next field has a calculated expression showing the person's age:
=(Date()-[DateOfBirth])/365.

My problem is, the result is displayed to 7 decimal places. How do I format
it to round off as a whole number?
 
T

Tom Lake

PeterK said:
I have a table with personal client information. One field shows date of
birth; the next field has a calculated expression showing the person's
age:
=(Date()-[DateOfBirth])/365.

=Round((Date()-[DateOfBirth])/365., 0)

This won't, however, give a true age since it doesn't take into account leap
years.

Tom Lake
 
J

Jeff Boyce

Peter

Two answers:

First, DON'T! As soon as you insert the calculated Age for a row, you risk
being wrong. How frequently (every day, once a month, once a year) will you
"refresh" this calculation? Since you have a calculation that works for you
(although you may wish to check the mvps.org website on this topic), use
this calculation in a query to calculate Age on-the-fly.

Second, the underlying table has data types for the fields. What data type
is the field you are using?
 
N

Nikos Yannacopoulos

Peter,

=Format((Date()-[DateOfBirth])/365, "0")

Instead should do it.

HTH,
Nikos
 

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