Last Date

G

Guest

I have a donation table which has the fields; date, donation,amount and last donation. There is also a donor table. How do I populate the last donation field? How can I do a query to find people that have not donated in the last 2 years

Thank
Jeff
 
A

Allen Browne

Do not store the last donation.
Just use a text box with ControlSource of:
=DMax("DonationDate", "tblDonation", "DonorID = " & Nz([DonorID], 0))

To find the people who have NOT donated in the last 2 years, it may be
easiest to use a subquery:

SELECT * FROM tblDonor
WHERE NOT EXISTS (
SELECT DonationID FROM tblDonation
WHERE (DonationDate >= DateAdd("yyyy", 2, Date()))
AND (tblDonationID.DonorID = tblDonor.DonorID) );

If the subquery seems too strange, create a query that does select the
donors from the last 2 years, and then use the Unmatched Query wizard to
combine it with the donors table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

JeffF2F said:
I have a donation table which has the fields; date, donation,amount and
last donation. There is also a donor table. How do I populate the last
donation field? How can I do a query to find people that have not donated
in the last 2 years?
 

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

Similar Threads


Top