Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DateSerial (A2K3)

    I know there is a DateSerial Function that can get the current or previous months data, for instance this will pull the previous months data:
    <hr>Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)<hr>

    Is there such a function or can this be modified to get the previous months data but the PREVIOUS YEAR and the PREVIOUS MONTH?

    I need to pull comparative data each month, for instance:
    If we are in November, I need October's data for this year and I need October's data for the last YEAR
    If we are in December, I need November's data for this year and I need November's data for the last YEAR
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DateSerial (A2K3)

    I think I have it.

    <hr>Between DateSerial(Year(Date())-1,Month(Date())-2,1) And DateSerial(Year(Date())-1,Month(Date())-1,0)<hr>

    If anyone knows of a more effecient way, please let me know.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

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

    Re: DateSerial (A2K3)

    Your solution will work, and it is probably the easiest to understand and maintain, but DateSerial is pretty forgiving as to what arguments you provide, so you could also use

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

Posting Permissions

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