SQL for Post Obtaining "Current Balance" ...

S

Such a Beginner

Here is my SQL

SELECT qryArvestDeposits.SumOfAmount4, qryArvestCreditPayments.SumOfAmount3,
qryArvestChecks.SumOfAmount2, qryArvestDebits.SumOfAmount1,
[SumOfAmount4]-[SumOfAmount3]-[SumOfAmount2]-[SumOfAmount1] AS Balance FROM
qryArvestChecks, qryArvestDebits, qryArvestDeposits,
qryArvestCreditPayments;
 
K

KARL DEWEY

This will be your union query. Name it Balance_1.
SELECT qryArvestDeposits.SumOfAmount4, NULL AS
qryArvestCreditPayments.SumOfAmount3, NULL AS
qryArvestChecks.SumOfAmount2, NULL AS qryArvestDebits.SumOfAmount1
FROM qryArvestDeposits
UNION SELECT NULL, qryArvestCreditPayments.SumOfAmount3, NULL, NULL
FROM qryArvestCreditPayments
UNION SELECT NULL, NULL,qryArvestChecks.SumOfAmount2, NULL
FROM qryArvestChecks
UNION SELECT NULL, NULL, NULL, qryArvestDebits.SumOfAmount1
FROM qryArvestDebits;

Then a totaling select query
SELECT
Sum(Nz([SumOfAmount4],0)-Nz([SumOfAmount3],0)-Nz([SumOfAmount2],0)-Nz([SumOfAmount1],0)) AS Balance
FROM Balance_1;
 

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

Top