Hail and well met, friends!
I am having a problem with DSUM criteria. I am new to working with databases and thoroughly confused by the use of quotes, dblquotes, brackets, and parentheses which I believe is the issue I am grappling with in this situation. I think that the answer is simple but I have searched high and low and tried many, many iterations of the query below, without any luck. I am hopeful that you all can help me.
- I have a simple table (“TEST tblInvoices”) that I want to run DSUM on.
- My table has 21 records and several fields but I am concerned with only 2 of them… “CompName_FK” (number field) and “Charge” (which is currency field).
- Within the 21 records, I have 6 unique values for CompName_FK.
- I am looking to use DSUM to total up all of the Charge values, and then return a single record for each CompName, with the total Charge.
- The query I am running is below.
- It returns the same 21 records but in the “Total Costs” column, the value is the same for each of the 21 records. It has calculated the sum across the entire domain, returned the same value for each record AND it did not group my CompName_FK values as expected.
Total Costs: DSum("[TEST tblInvoices]![Charge]","TEST tblInvoices","[TEST tblInvoices]![CompName_FK] =" & "[TEST tblInvoices]![CompName_FK]")
Any advice is greatly appreciated.
Mark
Access 2010
I am having a problem with DSUM criteria. I am new to working with databases and thoroughly confused by the use of quotes, dblquotes, brackets, and parentheses which I believe is the issue I am grappling with in this situation. I think that the answer is simple but I have searched high and low and tried many, many iterations of the query below, without any luck. I am hopeful that you all can help me.
- I have a simple table (“TEST tblInvoices”) that I want to run DSUM on.
- My table has 21 records and several fields but I am concerned with only 2 of them… “CompName_FK” (number field) and “Charge” (which is currency field).
- Within the 21 records, I have 6 unique values for CompName_FK.
- I am looking to use DSUM to total up all of the Charge values, and then return a single record for each CompName, with the total Charge.
- The query I am running is below.
- It returns the same 21 records but in the “Total Costs” column, the value is the same for each of the 21 records. It has calculated the sum across the entire domain, returned the same value for each record AND it did not group my CompName_FK values as expected.
Total Costs: DSum("[TEST tblInvoices]![Charge]","TEST tblInvoices","[TEST tblInvoices]![CompName_FK] =" & "[TEST tblInvoices]![CompName_FK]")
Any advice is greatly appreciated.
Mark
Access 2010