none
Calculating dates RRS feed

  • Question

  • Hello all,

    Perhaps this is easy, and I'm just being dense...

    I would like to build a criteria for a date field that returns any record from 11 months ago or greater.

    In other words, if I run the query today (7.29.15), I want it to return any record where that field has a date of 8.1.14 or greater.

    Any help is greatly appreciated.

    Thanks!

    Wednesday, July 29, 2015 6:26 PM

Answers

  • Hi,

    I usually use the DateAdd() function. For example, you could try the following criteria:

    >=DateAdd("m",-11,Date())

    Hope that helps...

    PS. Unless your example dates are a strict rule, the above criteria I gave you will subtract 11 months to today's date, which would result in 8.29.14 - is that okay? If not, you could try 12 months or something like this which should return 8.1.14:

    >=DateSerial(Year(Date()), Month(Date())-11, 1)

    Cheers!

    • Edited by .theDBguy Wednesday, July 29, 2015 6:38 PM
    • Proposed as answer by Naomi N Wednesday, July 29, 2015 6:40 PM
    • Marked as answer by Casey_M Wednesday, July 29, 2015 6:58 PM
    Wednesday, July 29, 2015 6:34 PM