Querying records for the last 2 weeks

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ckpoll2
    New Member
    • Sep 2006
    • 76

    Querying records for the last 2 weeks

    I'm trying to build a query that will return data for the last 14 days regardless of what date the query is being run. Here's what I have under the criteria section:

    Between Now() And (Now()-14)

    I think that this is close to what I need, but it's not quite returning exactly what I want. How can I fix this?

    Thanks,

    Charlie
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by ckpoll2
    I'm trying to build a query that will return data for the last 14 days regardless of what date the query is being run. Here's what I have under the criteria section:

    Between Now() And (Now()-14)

    I think that this is close to what I need, but it's not quite returning exactly what I want. How can I fix this?

    Thanks,

    Charlie
    This should do it:
    DateAdd("d",-14,Now())

    Comment

    • ckpoll2
      New Member
      • Sep 2006
      • 76

      #3
      Originally posted by ADezii
      This should do it:
      DateAdd("d",-14,Now())

      That didn't return anything when I put it in. Any other suggestions?

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        Try this:

        Code:
        Between Now() And DateAdd("d", -14, Now())
        Remember that Now is a full timestamp including time value. You could try replacing Now() with Date() and see if this gives a more accurate return.

        Code:
        Between Date() And DateAdd("d", -14, Date())

        Originally posted by ckpoll2
        That didn't return anything when I put it in. Any other suggestions?

        Comment

        • PEB
          Recognized Expert Top Contributor
          • Aug 2006
          • 1418

          #5
          You can also try:
          Between int(Now())-14 And int(Now())

          Comment

          Working...