access 2003 how do I use the difference between a date in the record and today

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • erniemack
    New Member
    • Mar 2010
    • 10

    access 2003 how do I use the difference between a date in the record and today

    Hello I am an old programmer (since 1964) but new to access. I have a Job table that contains a "promise date". I want a query that will extract all records whose "promise date" is within 3 days of the current date. This has got to be simple but I am probably looking for something hard. Thanks in advance.
  • patjones
    Recognized Expert Contributor
    • Jun 2007
    • 931

    #2
    Hi ernie -

    In Access there is a built-in function called DateDiff. The Access help pages do a nice job discussing DateDiff, but I'll just say that in your case you'll want to write out the criteria to be something like

    Code:
    Abs(DateDiff("d", Now(), [promise date])) <= 3

    Here, "d" just means that you want whole days to be the time interval that the function works with. Of course, there are other important details, like whether you are doing this in Query Design view, or in VBA code. Let me know some more of how you're trying to accomplish this and I can fine-tune the answer for you.

    And, as an aside, seeing that you were programming back in 1964, would any of your experience happen to have been with FORTRAN?

    Pat

    Comment

    • erniemack
      New Member
      • Mar 2010
      • 10

      #3
      Actually I found my own answer. In the criteria for the query in the desired field I used >now()+3

      Comment

      Working...