Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dates in Query (Office 2000)

    Hello,
    I have a report built on a query to return "monthly invoices". As the name suggests, I can see all of the invoices that were done for the month before. I currently use the "Between #4/1/2005# And #4/30/2005#" criteria in the query and every month I need to exit from the form I'm working in and change the criteria. Is there an easier way to do this? Is there another criteria that I can enter that will automatically give me the previous month's activity?

    Thanks!
    Louise

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

    Re: Dates in Query (Office 2000)

    Hello Louise,

    Try this:

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

    This will always select dates in the previous calendar month. DateSerial is a function that takes year, month and day arguments and returns the corresponding date. This is combined with the Year, Month and Date functions. The 0-th day of the current month is equivalent to the last day of the previous month.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dates in Query (Office 2000)

    Thanks Hans! You're the greatest!
    Louise

  4. #4
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dates in Query (Office 2000)

    ((He knows)) <img src=/S/alien.gif border=0 alt=alien width=14 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

Posting Permissions

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