Query "Sum"

  • Thread starter Thread starter Bob Vance
  • Start date Start date
B

Bob Vance

If my query has these 2 fields in it "Total Due" and "Paid Amount" what
expression do I use to get "Total Due" Minus "Paid Amount"
 
You use a Calculated Field in your query. In the Query builder where you
put the name of the field, you make up a name followed by a colon, then you
put in the expression. It would look like this:

AmountRemaining: [Total Due] - [Paid Amount]

The name AmountRemaining is only an example. Use any name you want.
 
Oops Got it
Payable:
Nz(qTotalDueForPayment.TotalDue,0)-Nz(qPaidAmountForPayment.PaidTotal,0)
 
Because TotalDue is an expression of a sum that is creating a problem
Thanks Bob

SELECT tblInvoice.OwnerID, Sum(tblInvoice.OwnerPercentAmount) AS TotalDue,
qPaidAmountForPayment.PaidTotal, Max(tblInvoice.InvoiceDate) AS
MaxOfInvoiceDate
FROM tblInvoice LEFT JOIN qPaidAmountForPayment ON tblInvoice.OwnerID =
qPaidAmountForPayment.OwnerID
GROUP BY tblInvoice.OwnerID, qPaidAmountForPayment.PaidTotal
ORDER BY tblInvoice.OwnerID;

Klatuu said:
You use a Calculated Field in your query. In the Query builder where you
put the name of the field, you make up a name followed by a colon, then
you put in the expression. It would look like this:

AmountRemaining: [Total Due] - [Paid Amount]

The name AmountRemaining is only an example. Use any name you want.

Bob Vance said:
If my query has these 2 fields in it "Total Due" and "Paid Amount" what
expression do I use to get "Total Due" Minus "Paid Amount"
 
Glad you got it working, but in the future, you get more accurate answers if
you include all the information in the original post.

Bob Vance said:
Because TotalDue is an expression of a sum that is creating a problem
Thanks Bob

SELECT tblInvoice.OwnerID, Sum(tblInvoice.OwnerPercentAmount) AS TotalDue,
qPaidAmountForPayment.PaidTotal, Max(tblInvoice.InvoiceDate) AS
MaxOfInvoiceDate
FROM tblInvoice LEFT JOIN qPaidAmountForPayment ON tblInvoice.OwnerID =
qPaidAmountForPayment.OwnerID
GROUP BY tblInvoice.OwnerID, qPaidAmountForPayment.PaidTotal
ORDER BY tblInvoice.OwnerID;

Klatuu said:
You use a Calculated Field in your query. In the Query builder where you
put the name of the field, you make up a name followed by a colon, then
you put in the expression. It would look like this:

AmountRemaining: [Total Due] - [Paid Amount]

The name AmountRemaining is only an example. Use any name you want.

Bob Vance said:
If my query has these 2 fields in it "Total Due" and "Paid Amount"
what expression do I use to get "Total Due" Minus "Paid Amount"
 
I had to make a new query because one of the fields was a sum

SELECT qTotalDueForPaymentOne.OwnerID, qTotalDueForPaymentOne.TotalDue,
qTotalDueForPaymentOne.PaidTotal, qTotalDueForPaymentOne.MaxOfInvoiceDate,
[TotalDue]-[PaidTotal] AS AmountRemaining
FROM qTotalDueForPaymentOne;
Thanks Klatuu

Klatuu said:
Glad you got it working, but in the future, you get more accurate answers
if you include all the information in the original post.

Bob Vance said:
Because TotalDue is an expression of a sum that is creating a problem
Thanks Bob

SELECT tblInvoice.OwnerID, Sum(tblInvoice.OwnerPercentAmount) AS
TotalDue, qPaidAmountForPayment.PaidTotal, Max(tblInvoice.InvoiceDate) AS
MaxOfInvoiceDate
FROM tblInvoice LEFT JOIN qPaidAmountForPayment ON tblInvoice.OwnerID =
qPaidAmountForPayment.OwnerID
GROUP BY tblInvoice.OwnerID, qPaidAmountForPayment.PaidTotal
ORDER BY tblInvoice.OwnerID;

Klatuu said:
You use a Calculated Field in your query. In the Query builder where
you put the name of the field, you make up a name followed by a colon,
then you put in the expression. It would look like this:

AmountRemaining: [Total Due] - [Paid Amount]

The name AmountRemaining is only an example. Use any name you want.


If my query has these 2 fields in it "Total Due" and "Paid Amount"
what expression do I use to get "Total Due" Minus "Paid Amount"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

"Enter Parameter Value" 4
Access Access 2010 report summing 0
Queries calculation 1
Retrieving old data 3
Access Query problem 1
Query for earliest due date 5
convert text to numeric values 8
How to have Report print... "Paid" if PmtAmt>0 ? 5

Back
Top