Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sunrise, Florida
    Posts
    324
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Records Modified The Previous Month (2003)

    My database has a field called "ActivityDate", that is modified every time an "activity" is entered. I want a query that will identify/extract/pull only those records that show an activity for the month previous to the one the query is being run. Any guidance is appreciated. Thanks!!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Records Modified The Previous Month (2003)

    Do you mean the previous calendar month (i.e. for today it would be December 2008)? If so, try this:
    - Create a query based on the table.
    - Add the fields that you want to return, including ActivityDate.
    - Enter the following in the Criteria line for ActivityDate:

    Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sunrise, Florida
    Posts
    324
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Records Modified The Previous Month (2003)

    Hey, HansV ... thanks for your usual help. BTW, the best to you and yours in 2009!

    Tried your suggestion but it also selects previous dates other than the previous calendar month. Hopefully either I screwed up or you can help me further. Thanks in advance!!!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Records Modified The Previous Month (2003)

    Best wishes for 2009!

    DateSerial(Year(Date()),Month(Date())-1,1) is the first day of the previous calendar month, and DateSerial(Year(Date()),Month(Date()),0) is the zero-th day of the current month, i.e. the last day of the previous month, so the expression should only return records for the previous calendar month. Check carefully that you entered the expression in the first Criteria row of the relevant column.

    If you can't find what's wrong, could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sunrise, Florida
    Posts
    324
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Records Modified The Previous Month (2003)

    Like I said ... I must have screwed up intially. Did it all over again and it worked like a charm. Once again ... thanks. The best to you and yours, too!

Posting Permissions

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