rick roberts
01-22-2003, 05:11 AM
on creating an aggregate this leaves a variable as an answer --the variable cannot be used again in another aggregate within the same query -it seems a very fundemental request but i cant get around it without using further queries to change the variables to a constant - i can get around this by using crosstabs but then these cannot be used in a subform
ie. Total Price:[unit price]*[quantity] gives an aggregate but how do i get a sum of the Total Price that can be used in a subform without using a crosstab? the problem is compounded by the fact that i ned these answers for every id number
Since TotalPrice is returned by the Query you can Sum it in the subform footer. =Sum([TotalPrice]) as the control source for an unbound textbox
rick roberts
01-24-2003, 03:15 AM
now i have a problem if i want to use the resulting ansewr in another aggregate witihn a query --such as Grant Total of Units --and if i want to add vat onto that--- the problem carries on ad infinitum
another difficulty i find is that if i use a total or grouping within a query-- it leaves it in a state where no new records can be added???? --if i could cure that problem i may be able to build query upon query to solve the first
Pat Hartman
01-25-2003, 09:17 PM
I'll address your last issue first. If you want Access to update a row in a table, you need to tell it specifically which row. If you have an aggregate query, the rows do not coorespond to individual rows in a table. Each row in an aggregate query aggregates the values from multiple rows so how would you tell Access exactly which row needed to be updated?
As to the rest, use a report if you need multiple levels of aggregation. A query can only aggregate to a single level.
You can include expressions within aggregate expressions:
Sum([unit price]*[quantity])
The above statement will sum the product of Unit price and quantity.
rick roberts
01-29-2003, 03:13 AM
so i can have as many aggregates as i want in a report? for as many levels as i want? --presumably only in the report footer - can i inport data from a multiple of queries to obtain these aggregates?