access database to calculate age and automatically update

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

Guest

HELLLPPP! I need to learn to have my access db caluclate and update client
age info. I was previously given this input mask that has ceased to work now,
although it did for a little while:

"DateDiff(yyyy","[dob]","Now())+(Format([dob]","mmdd)">"Format(Now()","mmdd))"

can anyone help?
 
What do you mean by "has ceased to work"? Are you getting an error? If so,
what is the error?

You may have a problem with your references.

Open any code module, then select Tools | References from the menu bar.
Examine all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

However, you shouldn't be updating client age information: you shouldn't be
storing it at all. Instead, you should have a query that includes that
formula as a computed field, and use the query wherever you would otherwise
have used the table.
 
Toni,
Lots of different ways to do this... with lots of varying opinions...
Search Google Groups under "calculate age" for multiple methods.

DateDiff("d", DOB, Date) / 365.25
should do it.
 
That can be fairly inaccurate, especially as people grow older so that there
are more leap years involved.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Al Camp said:
Toni,
Lots of different ways to do this... with lots of varying opinions...
Search Google Groups under "calculate age" for multiple methods.

DateDiff("d", DOB, Date) / 365.25
should do it.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Toni Marie said:
HELLLPPP! I need to learn to have my access db caluclate and update
client
age info. I was previously given this input mask that has ceased to work
now,
although it did for a little while:

"DateDiff(yyyy","[dob]","Now())+(Format([dob]","mmdd)">"Format(Now()","mmdd))"

can anyone help?
 
Douglas,
Yes, I checked out a lot of "Age" code in the Google Access newsgroups. Some of the
links I really wanted to see are no longer functional.
I chose that one, as I though it the easiest to understand and implement. I was also
a bit limited in time to search all the hits..
I was careful to add... "check out the Googlen Access ngs for other solutions."

But... wouldn't the 365.25 pick up that Leap Year error every four years? The minor
error in the calculation would be, first year .25, 2nd year .50, 3rd year.75, (of a day)
and then correct again on the 4th?

Thanks Douglas,

Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Douglas J. Steele said:
That can be fairly inaccurate, especially as people grow older so that there are more
leap years involved.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Al Camp said:
Toni,
Lots of different ways to do this... with lots of varying opinions...
Search Google Groups under "calculate age" for multiple methods.

DateDiff("d", DOB, Date) / 365.25
should do it.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Toni Marie said:
HELLLPPP! I need to learn to have my access db caluclate and update client
age info. I was previously given this input mask that has ceased to work now,
although it did for a little while:

"DateDiff(yyyy","[dob]","Now())+(Format([dob]","mmdd)">"Format(Now()","mmdd))"

can anyone help?
 
Back
Top