Sarah,
How are the fees and the businesses linked? I can assume that the tables
look something like:
Owners (OwnerID (PK), BusID, other)
Business(BusID (PK), ownerID, BusName, other)
Fees --- Here I get lost.
It seems that you need another table in here. If there is more than a single
kind of fee (implied by the name 'Fees'- at least to me), than Fees would
look something like: Fees (feeType, feeAmount?). But then someplace else is
needed to keep track of which businesses paid/pay which fees.
If there is only a single fee type, than it seems likely that Fees would
look like:
Fees (BusID, Amt, DatePaid, other)
In which case, you're simply looking for those businesses that have paid in
the past but not this year (unless of course every business must pay each
year). In that case, your query would be: (WARNING- THIS IS UNTESTED!)
select B.BusID, B.BusName
from Business as B INNER JOIN Fees as F
on B.BusID = F.BusID
where ( (select count(*) from Fees as F2
where F2.BusID = F.BusID
and Year (F.DatePaid) < Year(Date()) >= 1 )
and ( (select count(*) from Fees as F3
where F3.BusID = F.BusID
and Year(F.DatePaid = Year(Date ()) = 0 )
(It would be great if there was a syntax to embed comments in your Jet SQL
as you go). The first half of the where clause asks are there records from
previous years in which this business paid fees (Note: this doesn't
guarantee that they made payments last year, although that can be checked
with a minor change) and the second half asks whether they made payments in
the current year.
But, as I said, this assumes there is only one Fee type, so separate FeeType
and FeesPaid tables are not needed. It would also be simpler if I knew that
there was a reason to expect the Business to be paying the fees this year. I
don't see any information indicating how it is known that the business is
expected to make payments this year. If they must pay each year, than you
simply look for business with no DatePaid in this year.