Results 1 to 2 of 2
  1. #1
    xzero1484 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2011
    Posts
    1

    Counting Months

    Hi,



    I could use help on this one...

    I'm trying to figure out incremental savings for each part and having trouble building a query to calculate savings for a 12 month period. Each part will have a different starting month, then will need to record savings for 12 months starting then. An Example:

    Part A starts saving money in June 2010. Query should stop recording/showing savings after May 2011 (including May 2011)

    Part B starts saving money in April 2010. Query should stop recording/showing savings in March 2011(including March 2011)

    I'm trying to use the DateSerial funcition and can figure out the stop month, but I think there's an easier way to do this. I just want to make sure that the part savings starts recording at the start month and end after 12 months of accruing savings. Any help would work!

    Thanks,

    Ray

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Hi,

    Code:
    EndDateToTheDay: DateSerial(Year([YourStartDate])+1,Month([YourStartDate]),Day([YourStartDate])-1)
    will give you the full year ahead (less one day)

    for example:

    Code:
    YourStartDate	EndDateToTheDay
    30 Dec 2000	29 Dec 2001
    31 Dec 2000	30 Dec 2001
    01 Jan 2001	31 Dec 2001
    02 Jan 2001	01 Jan 2002
    03 Jan 2001	02 Jan 2002
    Code:
    EndDateToTheMonth: DateSerial(Year([YourStartDate])+1,Month([YourStartDate]),0)
    will give you the end of the 12th month

    for example:

    Code:
    YourStartDate	EndDateToTheMonth
    30 Dec 2000	30 Nov 2001
    31 Dec 2000	30 Nov 2001
    01 Jan 2001	31 Dec 2001
    02 Jan 2001	31 Dec 2001
    03 Jan 2001	31 Dec 2001
    Cheers,

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Percent Change between months by group
    By P5C768 in forum Queries
    Replies: 3
    Last Post: 09-15-2010, 06:59 PM
  2. separate a form by months
    By graciemora in forum Forms
    Replies: 40
    Last Post: 08-19-2010, 01:46 PM
  3. Total all months in query or report
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 10-23-2009, 08:41 AM
  4. How to show all months
    By Brian62 in forum Queries
    Replies: 4
    Last Post: 10-20-2009, 08:55 AM
  5. A months query
    By Peljo in forum Access
    Replies: 1
    Last Post: 02-18-2008, 09:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums