I have two date fields : start_period and end_period, i need to find the total of amount field within a date range
I have two date fields ,start _period and end_period, i need to get the total
Collapse
X
-
Hi
MaybeCode:Sum([Amount Field]) FROM TableName WHERE Start_Period <= #StartDate# And end_period >= #EndDate#
StartDate and EndDate could be the same date!
MTB -
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
Comment