My problem is that I have to create a lot of queries with different grouping. For example, I have to group the data in regard of product type or the region so that I have to build two different queries, but only one parameter changes. Is there a way avoid creating a lot of queries by passing the grouping argument to the query or with VBA ? Here's a look of two of my queries, the only difference is Test.Product vs Test.Region.
SELECT Test.Product, Sum(Test.Prices) AS SumOfPrices
GROUP BY Test.Product;
SELECT Test.Region, Sum(Test.Prices) AS SumOfPrices
GROUP BY Test.Region;