How to compare two date fields for num of days difference between?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chellie
    New Member
    • Jul 2010
    • 1

    How to compare two date fields for num of days difference between?

    I am using Access 2007. I have two date fields (date receievd and date complete). I need to be able to run a query and find out who is not completing their work within two days of receipt. I tried using datediff but can't figure it out. Any thoughts? I would appreciate it!

    Chellie
  • gershwyn
    New Member
    • Feb 2010
    • 122

    #2
    The syntax for DateDiff would be something like this:
    Code:
    DateDiff("d", [Date Received], [Date Complete])
    That will give you the difference between the two fields, expressed in days. Add that as a column in your query and you can set whatever criteria you want to filter the results that the query returns.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32663

      #3
      I would suggest a WHERE clause in your query's SQL of :
      Code:
      WHERE DateDiff('d',[Date Received],[Date Completed])>2
      By the way, please check the spelling of your field names. I very much hope they are not as you have posted them. Generally it is appreciated if you post your question accurately, as this can save wasted time and effort.

      Welcome to Bytes!

      Comment

      Working...