QUERY/DATE

  • Thread starter Thread starter MUSIWA
  • Start date Start 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
 
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.
 
Back
Top