age range onto a form, then generate the report using those details. This is
how i have that SQL in the report query. The form simply has two text boxes
(AgeStart & AgeFinish) and a button to open the report in preview form. This
returns everybody, but may be another way of working if we can figure it.
Cheers
SELECT tblIndividuals.DateofBirth, tblIndividuals.IndividualID,
tblIndividuals.FamilyID, tblIndividuals.Name, tblIndividuals.DiffLastName,
tblIndividuals.[Male/Female], tblFamilyDetails.FamilyName,
tblFamilyDetails.Current, tblIndividuals.Current,
Int((Date()-[DateofBirth])/365.25) AS Age
FROM tblFamilyDetails INNER JOIN tblIndividuals ON tblFamilyDetails.FamilyID
= tblIndividuals.FamilyID
WHERE (((tblFamilyDetails.Current)=True) AND ((tblIndividuals.Current)=True)
AND
(((Int((Date()-[DateofBirth])/365.25))>=[forms]![frmreports].[agestart])<=[forms]![frmreports].[agefinish]));
_____________________________________________-
:
Yes it is. Thanks.
SELECT tblIndividuals.DateofBirth, tblIndividuals.IndividualID,
tblIndividuals.FamilyID, tblIndividuals.Name, tblIndividuals.DiffLastName,
tblIndividuals.[Male/Female], tblFamilyDetails.FamilyName,
tblFamilyDetails.Current, tblIndividuals.Current,
Int((Date()-[DateofBirth])/365.25) AS Age
FROM tblFamilyDetails INNER JOIN tblIndividuals ON tblFamilyDetails.FamilyID
= tblIndividuals.FamilyID
WHERE (((tblIndividuals.DateofBirth) Is Not Null) AND
((tblFamilyDetails.Current)=True) AND ((tblIndividuals.Current)=True) AND
((Int((Date()-[DateofBirth])/365.25)) Between [Start Age] And [End Age]));
:
Weird. Post the SQL of the query.
Maybe I can spot waht's wrong.
As far as I can tell it is. I am in the query, and have set the field
property to General Number Format, but nothing. I have also set the
DateOfBirth format to ShortDate.
When I just use from 2 to 2, I get the correct result and it ignors the
20's, 32, 42 etc.
Cheers.
:
Is everything in a numeric form?
Sounds like it is treating yoour age like text, where
2,21,22,
comes before 3,31,33, Just like
A,AB,ABC
comes before
B,BA,BAC.
Make sure your field types for Age are numeric.
Phil
azza wrote:
I am wanting to list poeple between ages that I specify. I have the
birthdates entered, and am using "Age: Int((Date()-[DateOfBirth])/365.25)" to
get the current age.
I am then using the Criteria in a query "Between [Enter Start Age] And
[Enter End Age]" to ask for the ages to show in the results. For example
poeple between ages 2 & 4.
However it is giving me results with any age that has the number 2, 3 or 4
in the age as the first or second digit.
Any ideas as to how I can make it only shoe me results for poeple 2, 3 or 4
(Or whatever age range I specify.
Thanks.