datediff function on access form. 2003. Returning "#ERROR"

Lifeseeker

Registered User.
Local time
Today, 11:40
Joined
Mar 18, 2011
Messages
273
Hi there,

I have an unbound textbox on the form that displays the difference between two dates.

Formula is below, but when I switch to form view, the textbox shows "#ERROR".

Anybody know why that might be the case?


In the Expression Building, this is what I put in the "Control Source"

=DateDiff('h',[cbc_test_done],[start date])

Field names are 100% correct though.
 
What is the name of the Control? Per chance is it the name of one of the field names?
 
What is the name of the Control? Per chance is it the name of one of the field names?

Two bound fields on the main form, and they are start date and CBC_Test_Time.

So this unbound text field will store datediff('h', [cbc_test_time],[start date]). (this is written in its control source in the expression builder).

When switched to form view, it shows "#ERROR".
 
=DateDiff("d",[Date_Delivered],[Date_Reported])

---- this definetly works for me..


=DateDiff("h",[cbc_test_done],[start date])

maybe you need "h"? instead of 'h' ?
 
function is implemented correctly. need to search for error in different places..

Try it. what the result will be?

=([start date]-[cbc_test_done])*24


.
 
DateDiff works for me... you are telling me the name of the fields you are using in the function. What is the name of the UNBOUND control you have placed them in.
 
Oops, also forgot to ask... What References do you have set?
 
=DateDiff("d",[Date_Delivered],[Date_Reported])

---- this definetly works for me..


=DateDiff("h",[cbc_test_done],[start date])

maybe you need "h"? instead of 'h' ?

Hi guys,

I made a mistake on my part here....one of the fields the formula referred to wasn't actually a date/time field.

But "h" and 'h' both works!

Thank you
 

Users who are viewing this thread

Back
Top Bottom