I have created a query to work the age bracket from the Date of Birth to date of visit, both fields are date and time
below are some example of this.
Note that the age bracket of 0-16 isn't a correct result. what is wrong with the query?
Date_Of_Birth DateofVisit Age Bracket
06-Oct-1907 09-May-2008 0 - 16
06-Oct-1907 12-May-2008 0 - 16
Age Bracket:
IIf(([DateofVisit]-([Date_Of_Birth]))/365<='16','0 - 16',
IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '17' And '30','17 - 30',
IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '31' And '65','31 - 65',
IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '66' And '75','66 - 74','75+'))))
below are some example of this.
Note that the age bracket of 0-16 isn't a correct result. what is wrong with the query?
Date_Of_Birth DateofVisit Age Bracket
06-Oct-1907 09-May-2008 0 - 16
06-Oct-1907 12-May-2008 0 - 16
Age Bracket:
IIf(([DateofVisit]-([Date_Of_Birth]))/365<='16','0 - 16',
IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '17' And '30','17 - 30',
IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '31' And '65','31 - 65',
IIf(([DateofVisit]-([Date_Of_Birth]))/365 Between '66' And '75','66 - 74','75+'))))