MS ACCESS DateDiff function

Hello everyone, i'm trying to get the MS ACCESS's function DateDiff working in one of my report queries.

See the official function doc here : http://office.microsoft.com/en-001/access-...A001228811.aspx

Here is my SQL query :
SELECT                                    
      DateDiff("s", IIf([topstartdatefield]>:START_DATE,[topstartdatefield],:START_DATE), IIf([topenddatefield]<:END_DATE,[topenddatefield],:END_DATE),vbUseSystem,vbUseSystem )          
FROM mytable;

This exact query works fine inside MS ACCESS (the application) but fails when inside a FDQuery (I'm using FireDAC) in FastReport with an error telling that too few parameters had been provided and that 6 are required.
Sometimes when I change parameters i have the same message with 7, 8 or even 9 parameters required.

Mu guess is that there is sort of a name conflict between ms access's DateDiff Function that i'm trying to use and FastReport's built-in DateDiff() function.

Can anybody help me?

Thanks

Comments

  • edited 7:06PM
    Ok, I found the problem.

    I need to put the first parameter in simple quotes and not in double quotes.
    so 's' instead of "s"

    Hope this helps anybody

Leave a Comment