How to use DateDiff in calculated field in access

user1181942 picture user1181942 · Dec 8, 2017 · Viewed 8.5k times · Source

I am trying to get "No of days late" in a particular table in MS access. I am trying to use calculated data type.

I have [ActualReturnDate] and [ReturnDate] in the same table (both are Date/Time) and I want to save difference between two columns in a calculated field.

I am using following expression:

DateDiff("d", [ActualReturnDate] , [ReturnDate] )

But no matter what i do I get error saying "The expression X cannot be used in a calculated column."

So does that mean I cannot use DateDiff in Calculated field? If not how should I do it?

Answer

Rene picture Rene · Dec 8, 2017

You indeed can't do this in a calculated field. Use a query instead, add a column and do the calculation in that column.