I have a Child care program that i want it to figure the cost per child based
on age in months. I use
DateDiff("m",[Birthdate],Now())+Int(Format(Now(),"mmdd")<Format([Birthdate],"mmdd")),
to figure the age in months. How do I set it to post this cost scheme. 0-18
months = $565.00; 19-36 months = $525.00; <37 months = $490.00
Where? In a query?
Charge:
IIf(DateDiff("m",[Adate],Now())+Int(Format(Now(),"mmdd")<Format([Adate],"mmdd"))
Between 0 And 18, 565,
IIf(DateDiff("m",[Adate],Now())+Int(Format(Now(),"mmdd")<Format([Adate],"mmdd"))
Between 19 And 36, 525,
IIf(DateDiff("m",[Adate],Now())+Int(Format(Now(),"mmdd")<Format([Adate],"mmdd"))>37,490)))
Directly in an unbound control on a form or report?
=IIf(DateDiff("m",[Adate],Now())+Int(Format(Now(),"mmdd")<Format([Adate],"mmdd"))
Between 0 And
18,565,IIf(DateDiff("m",[Adate],Now())+Int(Format(Now(),"mmdd")<Format([Adate],"mmdd"))
Between 19 And
36,525,IIf(DateDiff("m",[Adate],Now())+Int(Format(Now(),"mmdd")<Format([Adate],"mmdd"))>37,400)))
Change my [ADate] field name to [Birthdate].
Note: It's best not to use Now() in calculations like this. Now()
includes a time value, and while it won't affect this calculation, at
some point if used without knowing it's pitfalls, it may return
different results, depending upon the time of day the expression is
run. Use Date() whenever the time of day is not needed.