Extracting Age

B

Bernadette Wayne

I am trying to use a Parameter Query to extract specific
ages from a data base. I have a field called Date of
Birth and a Field that automatically calculates the age
with the Source Control as =Date()-Date of Birth, Fixed
and 1 decimal place. This works fine. I have set up a
parameter query using the criteria row with the parameter
as "BETWEEN[ENTER START AGE]AND[ENTER END AGE]"
When I run the query and enter say 1 as the start age and
5 as the end age, it returns all those that have an age
starting with 1, 2 ,3, 4 and 5 eg: 12, 25, 32 etc.

Any help would be appreciated and Thank You
 
D

Duane Hookom

Seems that your values are being treated like strings/text. You could try to
set your parameter data types. Select Query->Parameters and enter

[ENTER START AGE] Integer
[ENTER END AGE] Integer

Also, your expression isn't the most accurate since not every year has 365
days.

If you can't find the solution, come back with your full sql view.
--
Duane Hookom
MS Access MVP


Bernadette Wayne said:
Sorry Source control reads:
=(date() -[date of birth])/365
-----Original Message-----
I am trying to use a Parameter Query to extract specific
ages from a data base. I have a field called Date of
Birth and a Field that automatically calculates the age
with the Source Control as =Date()-Date of Birth, Fixed
and 1 decimal place. This works fine. I have set up a
parameter query using the criteria row with the parameter
as "BETWEEN[ENTER START AGE]AND[ENTER END AGE]"
When I run the query and enter say 1 as the start age and
5 as the end age, it returns all those that have an age
starting with 1, 2 ,3, 4 and 5 eg: 12, 25, 32 etc.

Any help would be appreciated and Thank You
.
 

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