How to design table for query info I need

L

Ladypep13

This one is a doozy and I'm a very basic user of Access. I am creating a
Membership database with multiple tables. One table is Members and another is
Contributions. Members may contribute multiple times a year and the
Contributions table has the date and amount of each contribution.

The Members table has a field which shows the next renewal date. Each month,
we pull out all the members whose renewal date is within that month and send
them a letter reminding them. The letter also says, "Your last contribution
of ____" and is filled in from the merge.

Here is my problem. I need my query to pull out the current month renewals
(no problem there, already done that) AND pull out only the very LAST
contribution they made.

Since each member's last contribution amount may have been on a different
date, I can't write the query to pull by a specific date, nor can I have it
pull by a > or < date.

Does anybody have any idea how I could design my Contributions table in
order to be able to pull out only the most current data on EVERY member and
merge it into a Microsoft Word form letter? It could be as simple as adding
an additional field, I don't know.

Any help is greatly appreciated.

Thanks!
 
J

Jeff Boyce

The subject of your post caught my eye ... because you really should NOT
design your table to fit your query. Your Access tables need to be
well-normalized if you are to gain the advantages of Access'
relationally-oriented features and functions. You need to adapt how you
query to the the data you need, not change the data.

That said, it sounds like you are looking for the most recent contribution
made by each member. Since you haven't really divulged the data structure
you are using, the following suggestions are very general in nature.

Find the Maximum [DateOfContribution] for each [Member] (Query1).

Find (calculate) the [RenewalDate] for each [Member] (Query2).

Join Q1 and Q2 together in a new query (Query3) and include both
[MaxDateOfContribution] and [RenewalDate].

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

John W. Vinson

The Members table has a field which shows the next renewal date. Each month,
we pull out all the members whose renewal date is within that month and send
them a letter reminding them. The letter also says, "Your last contribution
of ____" and is filled in from the merge.

Here is my problem. I need my query to pull out the current month renewals
(no problem there, already done that) AND pull out only the very LAST
contribution they made.

Since each member's last contribution amount may have been on a different
date, I can't write the query to pull by a specific date, nor can I have it
pull by a > or < date.

Does anybody have any idea how I could design my Contributions table in
order to be able to pull out only the most current data on EVERY member and
merge it into a Microsoft Word form letter? It could be as simple as adding
an additional field, I don't know.

No additional field is needed.

Instead, use a Subquery. As a criterion on the donation date field put

=(SELECT Max([donation date]) FROM donations AS X WHERE X.MemberID =
Members.MemberID)

This will filter the set of all donations from that member to show only the
most recent of them.
 

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

Top