I have two date fields ,start _period and end_period, i need to get the total

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chukwumq
    New Member
    • Jul 2010
    • 2

    I have two date fields ,start _period and end_period, i need to get the total

    I have two date fields : start_period and end_period, i need to find the total of amount field within a date range
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi

    Maybe
    Code:
    Sum([Amount Field]) FROM TableName WHERE Start_Period <= #StartDate# And end_period >= #EndDate#
    This is the stating pont, depending on where the SQL is defined/where the code is run and probable date formating issues, but it is a start!?

    StartDate and EndDate could be the same date!

    MTB

    Comment

    • Chukwumq
      New Member
      • Jul 2010
      • 2

      #3
      Hi MIke

      Thank you so much for your response, BUT,I will really like to create a parameter Query... Given the user the flexibilty to choose the date range. Find below ..

      I am presently working on a database using Access 2007. I was able to get the total sum for a particular account from the first date to the last date. But i couldn't get the total sum of between a date range.
      Take for example:
      Acc_Number Start_Period End_Period Amount
      1001 3/12/2010 3/26/2010 500
      1001 3/27/2010 4/6/2010 700
      1001 4/7/2010 4/21/2010 500

      I was able to get the total sum from 3/12/2010 to 3/26/2010 using the aggregate function in access i.e under the Start_Period field , i selected FIRST aggregate function and under End_Period field, i select LAST aggregate function, GROUP BY function for Acc_number and SUM function for Amount in the design sheet view .
      BUT AM UNABLE TO GET THE SUM BETWEEN 3/12/2010 - 4/6/2010. USING A PARAMETER QUERY, CAN THIS BE DONE. THANKS..

      Comment

      • colintis
        Contributor
        • Mar 2010
        • 255

        #4
        Can you post the query code that you are working on? otherwise its difficult for us to locate the problem you are having.

        Comment

        Working...