QUERY/DATE

M

MUSIWA

I have a query that calculates the age using Datedif
(DOB,date()) How do I get the query to update date() and
recalculate evertime I access the query. (DOB) date of
birth, Office 200, Win XP
 
J

John Vinson

I have a query that calculates the age using Datedif
(DOB,date()) How do I get the query to update date() and
recalculate evertime I access the query. (DOB) date of
birth, Office 200, Win XP

Ummm... this expression is incorrect and will not calculate an age.

Secondly, Date() gets updated every time you run the query already.
You don't need to do anything to make it do so!

I'd suggest putting

Age: DateDiff("yyyy", [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)

in a vacant Field cell in your query. This will correct for the cases
where someone hasn't yet reached their birthday.
 

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