Hi again,
I have solved most of my request by using this select query.
SELECT tblInvoices.CustomerID, tblInvoices.InvoiceID, tblInvoices.InvoiceNumber, tblInvoices.InvoiceDate, tblInvoices.InvoiceTotal, tblPayments.InvoiceID, tblPayments.PaymentID, tblPayments.PaymentDate, tblPayments.CheckNumber, tblPayments.DiscountAmount, tblPayments.PaymentAmount, tblCredits.InvoiceID, tblCredits.CreditID, tblCredits.CreditNumber, tblCredits.CreditDate, tblCredits.CreditAmount
FROM ((tblCustomers RIGHT JOIN tblInvoices ON tblCustomers.CustomerID = tblInvoices.CustomerID) LEFT JOIN tblCredits ON tblInvoices.InvoiceID = tblCredits.InvoiceID) LEFT JOIN tblPayments ON tblInvoices.InvoiceID = tblPayments.InvoiceID
WHERE (((tblInvoices.CustomerID)=[Forms]![frmToday].[CustomerID]) AND ((tblInvoices.InvoiceDate)>=[Forms]![frmToday]![StartDate] And (tblInvoices.InvoiceDate)<=[Forms]![frmToday]![EndDate]))
ORDER BY tblInvoices.CustomerID, tblInvoices.InvoiceID;
I have placed a text box on the ledger named BALANCE. The purpose of the Balance Text Box is to show the "living balance" of the customers' account. The Control Source is: =([InvoiceTotal])-([DiscountAmount]+[PaymentAmount]+[CreditAmount]) and I set itâs properties as running sum - over all. This works fine as long as each invoice is paid in full. When there are 2 or more payments made for the same invoice, it adds the same invoice total again for each payment. How can I select the invoice total only once no matter how many payments or credits there are for a specific invoice?
Thanks for any help!
D. Bartelt