I have 10 queries. Each uses the same table (tblAmt) and gets a sum from the same field (Amount). The only difference between the queries is that the Amount field is restricted to a different range in each query. I then use another query to collect all 10 sums for use in a report.
I want to create a function that uses 2 parameters (the Start and End values of the range) and results in the correct sum. That way I could use a single query where the columns are the function with the various parameter values supplied. I know I need a string variable that defines the SQL of the query, but I’m confused about using code with Recordsets, TableDefs, etc. Any sample code would be greatly appreciated.
I want to create a function that uses 2 parameters (the Start and End values of the range) and results in the correct sum. That way I could use a single query where the columns are the function with the various parameter values supplied. I know I need a string variable that defines the SQL of the query, but I’m confused about using code with Recordsets, TableDefs, etc. Any sample code would be greatly appreciated.