Counting Days between two dates in Days

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jennyp29
    New Member
    • Sep 2006
    • 18

    Counting Days between two dates in Days

    Hi

    Can you help me with this problem?

    1. I have two date fields, one a referral date and one an action date. I need to find out all those records that have a time span greater than 42 days between the two date.

    2. I also need to find out the number of days (if greater than 42 days) from referral date to today's date for all those records that have not yet received an active date

    I am unable to do programming, so need to keep it basic, is it possible?
  • MSeda
    Recognized Expert New Member
    • Sep 2006
    • 159

    #2
    Use the DateDiff function in your query to determine the number of days between the dates you can use an iif statement to insert today’s date where actiondate is null

    Code:
    DateDiff("d",[ReferralDate], iif(isnull([ActionDate]),Date(),[ActionDate])
    see how far this gets you and let us know if you need more help
    Last edited by NeoPa; May 1 '07, 11:38 PM. Reason: Tags

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32636

      #3
      Originally posted by MSeda
      Use the DateDiff function in your query to determine the number of days between the dates you can use an iif statement to insert today’s date where actiondate is null

      Code:
      DateDiff("d",[ReferralDate], iif(isnull([ActionDate]),Date(),[ActionDate])
      see how far this gets you and let us know if you need more help
      Another way to write that would be :
      Code:
      DateDiff("d",[ReferralDate], Nz([ActionDate],Date())
      Nz() is a very handy function that uses the first parameter unless it's null, in which case it uses the second. Excellent for situations like this.

      Comment

      Working...