Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query to calculate totals

Status
Not open for further replies.

eriel3

Programmer
Mar 19, 2004
30
US
I am trying to write a query that will calculate the total of the field AOG.

Can someone help me please.

Date AOG
04/01/04 300
04/02/04 400
04/03/04 500
04/04/04 600
TOTAL 1800
 
The total of AOG only, regardless of date?

Ascii dumb question, get a dumb Ansi
 
yes, well what i am going to do is put in a date parameter so that i could get the total on a date range.

so i guess the total for all records in the query
 
Because you want a date range, this becomes kind of tricky.

Obviousley, the easiest way is to use two queries, the first filters the data by your date range, the second calls the first query, and gives a total of your number.

The alternative is to use an iif function to test the date to see if it is within your range. The problem with that is you can't use a parameter query this way. So you have to put your date ranges on a form, and call the values on the form to test.

The first method is pretty easy, the second, if you want to do it, I will help.

ChaZ

Ascii dumb question, get a dumb Ansi
 
okay i know how to filter the data by date range, but how would i build the second query to do a total. i am not really good in sql. is there a way that i can does this in the query design view in access, that is (the second query)
 
In Acces, when you make a new query and it asks for which tables you want, there is a tab on top for both Tables, and queries, so you can use an existing query in a new query just like as if it were a table. So you can pull your fields and do your sums. Just remember to ommitt the date field, so you get one total.

ChaZ

Ascii dumb question, get a dumb Ansi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top