How do I word this?? Well here goes.
I have a master form that keeps track of court ordered restitution, amount owed, amount paid, balance due and such, within the master form is a subform that keeps track of method, date, and amount of each payment a defendant would make.
The amount paid from the master form gets its value from the Sum of the payment field in the subform.
Here is what I am trying to do. I want to keep track of who hasn’t paid the amount they were ordered to pay within a specified date. I created the query below that should return all records that meet this criteria.
[Amount Paid]<[Amount Ordered] OR Is Null AND [Date Due]<[Date()]
The date part works fine. It's the Is Null part that's killing me. It doesn't return the records where [Amount Paid] Is Null, because they haven't made a payment so therefore there is no record in the details table.
Does anyone understand what I'm saying?? I'm having trouble explaining it here, sorry. I really hope someone here can help. Thanks for trying to understand me. Here's the SQL.
SELECT DISTINCT tblMaster.[Docket #], tblMaster.[First Name], tblMaster.[Last Name], tblMaster.[Amount Ordered], Sum(tblDetails.Payment) AS [Amount Paid], [Amount Ordered]-[Amount Paid] AS [Balance Due], tblMaster.[Date Due], tblMaster.[Date Ordered]
FROM tblMaster RIGHT JOIN tblDetails ON tblMaster.[Docket #] = tblDetails.[Docket #]
GROUP BY tblMaster.[Docket #], tblMaster.[First Name], tblMaster.[Last Name], tblMaster.[Amount Ordered], [Amount Ordered]-[Amount Paid], tblMaster.[Date Due], tblMaster.[Date Ordered]
HAVING (((Sum(tblDetails.Payment))<[Amount Ordered]) AND ((tblMaster.[Date Due])<Date())) OR (((Sum(tblDetails.Payment)) Is Null));