Looking for previous month's beginning and ending dates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shawn29316
    New Member
    • Feb 2007
    • 33

    Looking for previous month's beginning and ending dates

    Hi,
    I'm trying to query a table to find records created between the first and last day of the previous month. I'm having no luck with the help feature in Access. Can someone point me in the right direction?

    Thanks,
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    First of the previous month
    Code:
    DateSerial(Year(Date), Month(Date) - 1, 1)
    Last of the previous month
    Code:
    DateSerial(Year(Date), Month(Date), 0)
    You can use these formulas with the Between operator in the criteria field for your date in the underlying query. Using it like this, you need to let Access know that Date is a function, not a field, so you have to add the parentheses after it, like Date(). The criteria would look like this:

    Code:
    Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)
    Linq ;0)>

    Comment

    Working...