Solved Query with domain aggregate (1 Viewer)

jamesave

New member
Local time
Today, 01:42
Joined
Apr 26, 2020
Messages
16
I have a simple table "InfoTable" with the following fields: "SetID", "Itemized", "Qty"

Try to run a simple query that create to the following statement from the QBE:

SELECT InfoTable.SetID, DSum("Qty","InfoTable","SetID=" & [SetID]) AS TotalQty
FROM InfoTable;

But it produces error:
"The object doesn't contain the Automation object 'Apple.'' " where Apple is one of the record in the SetID. What does it mean?
 

Attachments

  • DomainAggregate.accdb
    420 KB · Views: 70

Galaxiom

Super Moderator
Staff member
Local time
Today, 18:42
Joined
Jan 20, 2009
Messages
12,852
SetId is text so you need to concatenate quote delimiters.

Code:
SELECT InfoTable.SetID, DSum("Qty","InfoTable","SetID='" & [SetID] & "'") AS TotalQty
FROM InfoTable;

This would normally be done with an aggregate query.
Code:
SELECT InfoTable.SetID, Sum(Qty) AS TotalQty
FROM InfoTable
GROUP BY SetID;
Much more efficient but not able to be used for updating if that is what you need.
 

Users who are viewing this thread

Top Bottom