0
votes

I am trying to reference a field in my query in a DSUM Expression in the same query but I can't get it to work. Could you please help?

I want my 'Total $ Accrual' column in the below query to sum the 'Amount $' amounts in the 'Accruals Raw Data' table for each Accrual ID from the 'Accruals Master Data' table (as they are displayed in the query when the query runs).

enter image description here

When I run it the query opens an input box window instead.

enter image description here

I originally tried using the below formula but it says the field may refer to the 'Accrual ID' in more than 1 table, therefore I have tried to reference the field within the query using the screenshot instead.

Total $ Accrual: DSum("[Amount $]","Accruals Raw Data","[Accrual ID]='" & [Accrual ID] & "'")

Many Thanks

1
Which RDBMS are you using? - Strawberry
Are you using MySQL or MS Access? Don't tag products not involved. - jarlh

1 Answers

0
votes

Try this:

Total $ Accrual: DSum("[Amount $]","[Accruals Raw Data]","[Accrual ID]='" & [Accruals Master Data].[Accrual ID] & "'")

You have 2 tables in query with the same column name [Accrual ID], so Access asked to clarify which table you are referencing to.