Hi, I am trying to perform a query to find out the age demographics of the clients and their dependents in my database.
I have a clients table (ClientsT) with fields DOBC (date of birth of client), DOBD1 (date of birth Dependent 1) and DOBD2. Some clients do not have any dependents.
I can create a query and find the ages of the clients and dependents. Age for Clients, AgeD1 for Dependent 1, AgeD2 for Dependent 2. Then I have created another and imported the Age, AgeD1 and AgeD2 fields. I need to find people with an age less than 16, ages between 16 and 25, Ages over 55.
I type into a query field Under16: IIF([Age]<16 OR [AgeD1]<16 OR [AgeD2]<16,1,0)
Between16and25: IIF([Age]>=16 AND [Age]<25 OR [AgeD1]>=16 AND [AgeD1<25 OR [AgeD2]>=16 AND [AgeD2]<25,1,0)
Over55: IIF([Age]>=55 OR [AgeD1]>=55 OR [AgeD2]>=55,1,0)
I am not getting the answers I expect. I only have three records in my test so I know the formulae aren’t working.
what am I doing wrong?
I have a clients table (ClientsT) with fields DOBC (date of birth of client), DOBD1 (date of birth Dependent 1) and DOBD2. Some clients do not have any dependents.
I can create a query and find the ages of the clients and dependents. Age for Clients, AgeD1 for Dependent 1, AgeD2 for Dependent 2. Then I have created another and imported the Age, AgeD1 and AgeD2 fields. I need to find people with an age less than 16, ages between 16 and 25, Ages over 55.
I type into a query field Under16: IIF([Age]<16 OR [AgeD1]<16 OR [AgeD2]<16,1,0)
Between16and25: IIF([Age]>=16 AND [Age]<25 OR [AgeD1]>=16 AND [AgeD1<25 OR [AgeD2]>=16 AND [AgeD2]<25,1,0)
Over55: IIF([Age]>=55 OR [AgeD1]>=55 OR [AgeD2]>=55,1,0)
I am not getting the answers I expect. I only have three records in my test so I know the formulae aren’t working.
what am I doing wrong?