Originally Posted by
ketbdnetbp
Leonidsg -
Cannot replicate the problem as the query seems to work for me. However, because [Months] and [RM] are dependent, I would double check the syntax in the [Months] field. It should be:
Months: IIf((DatePart("d",[DOB])<=DatePart("d",[DateDx])),(Int(DateDiff("m",[DOB],[DateDx]))),(Int(DateDiff("m",[DOB],[DateDx])-1)))
...Change field names if needed.
The SQL for the query that works for me is:
SELECT Table4.ID, Table4.Name, Table4.[DOB], Table4.DateDx, IIf((DatePart("d",[DOB])<=DatePart("d",[DateDx])),(Int(DateDiff("m",[DOB],[DateDx]))),(Int(DateDiff("m",[DOB],[DateDx])-1))) AS Months, Int([Months] Mod 12) AS RM, Int([Months]/12) & " Years, " & [RM] & " Month(s)" AS AgeAtDiagnosis
FROM Table4;
I have also attached my test db, hope this helps,
Jim