Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2006
    Posts
    30

    Unanswered: Date Criteria Problem

    I'm back again

    I'm trying to build a query that will automatically (without user input) return records created within the last year...if run today, it would cover 5/1/2006 through 5/1/2007, if run tomorrow it would cover 5/2/2006 through 5/2/2007. I've been working on this for a couple of days but thus far the closest I've come is this,which returns records for the past two calendar years:

    Code:
    Between Year(Date()) And Year(Date())-1
    That's close but it's not quite what I need, and I've run out of ideas. Would someone please point me in the right direction?

  2. #2
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Use the function DateAdd

    Between DateAdd("yyyy", -1, Date()) And Date()

    Actually, this will give you one year plus one day. That is you will be including May 1st twice. So, you may want to use:
    Between DateAdd("d", 1, DateAdd("yyyy", -1, Date())) And Date()

    HTH,

  3. #3
    Join Date
    Dec 2006
    Posts
    30
    That did the trick! Is there an online reference for the various Access functions or am I stuck with the built-in help system? Thanks,

    Will

  4. #4
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    It's called Google. In this case I would suggest using a search string like: "ms access date functions" I did not follow any of the links, but at least 5 to 7 look VERY promising. Google is where I go 95% of the time to get MS Access help. Microsofts search, and help really don't (search or help).

Posting Permissions

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