Forum Discussion
Mercadogs
Sep 16, 2020Copper Contributor
Bills Paid Database
Hi there: I’m using Access 2016. I started database for bill payments. In that database i have a first table called Bills where I have fields concerning my bills, including a BillID field, DueDate,...
Woldman
Sep 23, 2020Iron Contributor
Hopefully, this query will do want you want:
SELECT b.BillID, b.Amount, b.DueDate
FROM Bills AS b LEFT JOIN Payments AS p ON b.BillID = p.BillID
WHERE (p.BillID Is Null) AND (SELECT DateAdd("m", 1, Dateserial( Year(MAX(DatePaid)), Month(MAX(DatePaid)), b.DueDay)) FROM Payments)<=(SELECT TOP 1 PayDate FROM PayDays WHERE PayDate >= Date() ORDER BY PayDate);
Good luck,
Tieme
Mercadogs
Sep 23, 2020Copper Contributor
Thanks! That certainly works better than anything I’ve been able to come up with on my own.
However, for some reason it is not returning all expected records.
So far, I only notice my mortgage Bill is missing from the results. It is due on the 1st of each month. And my next payday is on September 3rd. So, the mortgage bill should be showing up in the results, but doesn’t.
However, for some reason it is not returning all expected records.
So far, I only notice my mortgage Bill is missing from the results. It is due on the 1st of each month. And my next payday is on September 3rd. So, the mortgage bill should be showing up in the results, but doesn’t.
- MercadogsSep 23, 2020Copper ContributorThe last time I paid it was on September 1, 2020.
- MercadogsSep 23, 2020Copper ContributorAlso, how do I handle the situation when I add a nee bill that doesn’t have any payment history?
- MercadogsSep 23, 2020Copper ContributorActually, I realized that the results of this query only includes bills for which there is no previous payment history at all.