Discussion Locked

DateDiff

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am having difficulty in Access 2000 using the datediff function in a calculated expression:
DATEDIFF: DateDiff("mm",[REVIEW_DATE],[MEETING_DATE])

I am constantly getting the following error message:
"Undefined function 'datediff' in expression"

Can anyone tell me how I can resolve this issue?

Many thanks for your help in advance

3 replies

by adisha

I have come up with the following workaround . . .

In the query change the calculated expression to . . .

DATEDIFF : [REVIEW_DATE]-[MEETING_DATE]
this will callculate the difference in days

Whilst in the adjacent column
MONTHS: [DATEDIFF]/365.25*12
this will calculate the difference in months

It works :-) but I would still like to know why I got an error message in the first instance. Any help would be greatly appreciated.

by dklippert

In the DatDiff function:
DateDiff ( interval, date1, date2 )

The month interval is m not mm

Interval Explanation
yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second

http://tinyurl.com/2hb74

In the second case you are performing math on a field named DateDiff not the function

This discussion is closed to new replies.