Solved Creating DSum fields on Report (1 Viewer)

hbrehmer

Member
Local time
Yesterday, 19:35
Joined
Jan 10, 2020
Messages
78
Hello,
I am writing a report based on a query where I need to sum the quantity of a part based on a criteria (type of transaction). The DSum expression requires that I look at the query used, instead of the detail of the record in the report and my answer returned on the report is totaling all records in the query based on the criteria, not the individual record (part number).

I have tried the follow, but keep getting errors:

=DSum("[Quantity]","TEST1QRY", "[TEST1QRY]![Part Number] = [Inventory Transactions].Report![Part Number_Inventory]", And "[Transaction Type]![ID] = 1")

Please help!

Heidi
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 22:35
Joined
Jan 23, 2006
Messages
15,379
Please post the SQL of your query.

Query design ->SQL view->copy and Paste into your post.

Welcome to the forum.
 

hbrehmer

Member
Local time
Yesterday, 19:35
Joined
Jan 10, 2020
Messages
78
SELECT [Inventory Transactions].*, [Transaction Type].ID, Inventory.Customer
FROM Inventory INNER JOIN ([Transaction Type] INNER JOIN [Inventory Transactions] ON [Transaction Type].ID = [Inventory Transactions].[Transaction Type]) ON Inventory.ID = [Inventory Transactions].[Part Number];


Sorry, I should have sent this along, as well.

Thanks for the welcome.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:35
Joined
Feb 19, 2002
Messages
43,223
DSum() is a domain function. It operates on the ENTIRE domain so if you want only some of the set to be included, you need to include criteria.

For a report, you should be using sorting and grouping options and therefore Sum() rather than DSum() to summarize data.
 

Users who are viewing this thread

Top Bottom