Selasa, 03 April 2012

[MS_AccessPros] Re: Return Count of Records based on Age in Query

 

Art -
All you need is a Age function.

Public Function CalcAge(DOB As Variant)
'Purpose : Calculate age
'DateTime : 3/18/2000 10:50
'Author : Bill Mosca
On Error Resume Next

CalcAge = DateDiff("yyyy", DOB, Now()) _
+ Int(Format(Now(), "mmdd") < Format(DOB, "mmdd"))

End Function

Then use it in your query like this:
SELECT FirstName, LastName, DOB, CalcAge([DOB]) as Age
FROM MyTable

--- In MS_Access_Professionals@yahoogroups.com, "Art" <dbalorenzini@...> wrote:
>
> I need to get a count of records for all applicants 55 years of age or older.
>
> Fields
>
> ApplicantID
> DOB
>
> Please advise
>
> Thank you
>
> Art Lorenzini
> Aioux Falls.
>

__._,_.___
.

__,_._,___

Tidak ada komentar:

Posting Komentar