Question How to sum 2 fields from 2 different queries?

UnrealEnvy

Registered User.
Local time
Yesterday, 21:24
Joined
Jul 15, 2009
Messages
35
Hello,
I've got 2 different queries, each calculating a total.
Now, I'd like to do sum the 2 Total fields of these 2 different queries.
That means:

Query1Total+Query2Total=OverallTotal

I created a new queey to sum this up, but it doesn't work.
When I run the query I keep getting: "Enter Parameter Value" window, but I'm not supposed to because there are already values in Query1 and Query Totals.

How can I do this guys? Please help. Thank you.
 
Probably the easiest way is to use the DSUM function rather than queries.

As an aside, are you trying to sum data from two different tables? The possibly suggests that your database is not designed correctly (not normalised)

Regards
Chris
 
Probably the easiest way is to use the DSUM function rather than queries.

As an aside, are you trying to sum data from two different tables? The possibly suggests that your database is not designed correctly (not normalised)

Regards
Chris

Well, each query is based on a different table, yes.
How do I use the DSUM function? Please elaborate.
 
Do the two tables hold the same type of data? If so they should be combined into one table. Then summing using queries becomes trivial.

The format of DSUM is
DSum(field, table [, criteria] )


Example of DSUM:

DSUM("[field_A]","table1","[customerNo]=123") + DSUM("[field_B]","table2","[customerNo]=123")

You should take a look at the function in Access Help as it will gives more info.

hth
Chris
 
As it's still not clear to me, I've uploaded a sample of my DB.
Some of it is in hebrew, don't mind it - What I need you guys to check is in english.

There are 2 queries there, both have a field called: Total.
I need another field, in a table or query, that will be the sum of those fields. like: Table/query=Query1Total+Query2Total
Furthermore, in the Expenses query, How can I have the SUM OF ALL the rows under "Total" in a single field?

Please assist.
Thank you,
Tal.
 

Attachments

Users who are viewing this thread

Back
Top Bottom