On Wed, 15 Feb 2006 17:21:50 -0600, "Pedro Lerma"
<(E-Mail Removed)> wrote:
>I want to do a filter by ages from query, I have as fields "birthday" and
>"today", however when I write for example, on field_from_age(0) and
>field_until_age(3), my query filter show me person that have 1,2,3,15,17,
>years old.
>Someone can helpme???
>This is my WHERE CODE:
>
>WHERE ((((([consultas].[fecha]/365))-(([paciente].[fecha de
>nacimiento]/365))) between [edad1] And [edad2]));
>
>consulta=table name
>fecha=date
>paciente=date
>fecha de nacimiento=birthday
>edad1=age1
>edad2=age2
>thanks and I'm sorry my english isn't very well
>Pedro
>
There is an easier way to calculate age.
In a vacant Field cell in the query type
Edad: DateDiff("yyyy", [paciente].[fecha de nacimiento],
[consultas].[fecha]) - IIF(Format([paciente].[fecha de nacimiento],
"mmdd") > Format([consultas].[fecha], 1, 0)
Put a criterion on this of
BETWEEN [edad1] AND [edad2]
You may need to change the arguments to the DateDiff or Format
function - I don't have the Spanish version of Access so I'm not sure
if the arguments change. Buen suerte!
John W. Vinson[MVP]
|