Incorrect data type for operator or @Function

What is wrong with this piece of code? Why does it generate the error above?

jDiff := (dDateSolved - dDateReported) / 86400;

@If(jDiff < 0; @Prompt([OK]; “SIR for BRCS”; “Date Resolved must be equal to or greater than Date Reported”); dDateSolved)

dDateSolved & dDateReported are two fields on the same document. What I want to do is to display a warning message when the value entered by the user for dDateSolved is less than that for dDateReported.

Subject: Incorrect data type for operator or @Function

Where is this formula being used, and at what point does the error crop up? Do you get the prompt? I notice that this function returns either a true/false value (which results from the @Prompts) or a date. If the value this function produces is being used elsewhere, that might be a problem.

Subject: RE: Incorrect data type for operator or @Function

I use it in the Input Validation event of the dDateSolved field. The error crops up when the form switches from read to edit mode (I have an ‘Edit’ action button).I just wanna check that the date entered by the user in dDateSolved is equal to or greater than DateReported. DateReported is a computed field with the @Created formula.

Subject: Incorrect data type for operator or @Function

First port of call for me would be to double check that the dates are both dates - make sure that one or the other is not text.

Only suggesting this cos I had this exact problem this morning …

Subject: RE: Incorrect data type for operator or @Function

Thanks for the suggestion, but I’m very sure that both are Date fields.

Subject: RE: Incorrect data type for operator or @Function

Bear in mind, it is not a question of whether they are Date “fields”, but whether the items are actually dates. To give an example, if my form has a field on it called LastReceived of type Date, but I have never saved that document with a value set in LastReceived, the type will be text and the value will be “”.