filter for people based on birthdate

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

Guest

I need a way to filter for anyone over 19 based on their birthdate. The
catch is that the date is formated as a number yyyymmdd (which I can't
change). I tried to create a new field using now() and then created a field
using datediff but couldn't get it to work. Then I treated all as numbers
and just subtracted my now field from the birthdate field and that didn't
work.
 
The proper formula for calculating age (as of today) is...

DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(),"mmdd"))








I believe there is a function that will convert a number into a date. I
think DateValue does it.

In that case, You'd need to replace each instance of [Birtdate] in the above
formula with

DateValue([YourBirthdateFieldName])



I have not tested, but this should work.

Of course, you'd them put your criteria under this to only pull records
where the result is greater than 19.
 
How about criteria that looks like

<= Val(Format(DateDiff("yyyy",-19,Date()),"yyyymmdd"))

That is get the date that is 19 years ago, force it to be a text string in the
proper format, then get the numeric value of the string and test your date field
against that numeric value.
 
Back
Top