Results 1 to 3 of 3
  1. #1
    Join Date
    May 2014
    Posts
    98

    Unanswered: Calculating days between Start Date and Today ?

    Hi I have form which automatically takes a start value for today the fieldname is Date.
    now what I want to do is calculate the difference between Date and Today's date in days with 2 criteria's
    Ist criteria will be choosing the field which has a boolean field named Was Issue Resolved and has value as Null or False
    and second criteria will be to show only days with greater than 21 days

    This is what I m trying to do

    Expr3: DateDiff("d",[Date],[date()])

    but gives me error on date() as it can't find this parmater

    I tried this also
    >=DateAdd("d",-21,Date())

    But its not population difference between the Date and Today Date

    Please Help

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    If the field in red

    DateDiff("d",[Date],[date()])

    is actually Date, then you obviously have to change it! Date is a Reserved Word, in Access, and RWs should never be used as the name for anything in Access; sooner or later this practice will cause problems!

    Otherwise that bit of code looks correct.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Where is this code being used
    is it a filter ar where clause

    Date() is a vba function not a table or column name so doesnt require delimiting with square brackets

    datediff returns the difference in periods between two date values you nay be better iff using dateadd


    however I dont yse the query designer. Im old school and yse the sql view. I tend to think GUI tools come between you and the code ( and yes MS DOS 5 is a perfectly good OS).....
    So for ne oaste tgd actual sql here. Switch to SQL view to see yhat
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •