Youth table connects via primary key ID to foreign key ID in Moves table. Each month each client gets a clothing allowance and an allowance. The amount they receive is determined by their age. The formulas in the query are
Clothing: IIf([SSU]=0,IIf([respite]=0,IIf([age]>=12,74.16,IIf([Age]>=9 And [Age]<=11,64.89,IIf([Age]>=5 And [Age]<=8,55.62,IIf([Age]>=1 And [Age]<=4,42.23,37.08))))))
AND
Allowance: IIf([SSU]=0,IIf([Respite]>=0,IIf([age]>=12,43.26,IIf([Age]>=9 And [Age]<=11,23.69,IIf([Age]>=5 And [Age]<=8,13.39,IIf([Age]>=1 And [Age]<=4,12.36,11.33))))))
The report is pulled each month based on this query and the amounts are determined. The age is based on the DOB field.
Age: DateDiff("yyyy",[DOB],[Forms]![Input Dates]![EndDate])+Int(Format([Forms]![Input Dates]![EndDate],"mmdd")<Format([DOB],"mmdd"))
However, when a client changes age during the reporting month, I really need them to show up in the query twice. Using the example above, I would need to see Johnny as a 4 year old for 2 days and then Johnny as a 5 year old for the balance of the month so that he is paid the correct amount.
Example:
YouthName DOB Age InCare ClothingAmt AllowanceAmt
John Smith 7/3/2004 4 31 $42.23 $12.36
John Smith 7/3/2004 5 31 $55.62 $13.39
Naomi Jones 4/13/2004 5 31 $55.62 $13.39
Sam Iam 1/1/1999 10 31 $64.89 $23.69