If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to design table for query info I need
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! |
#2
|
|||
|
|||
How to design table for query info I need
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 "Ladypep13" wrote in message ... 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! |
#3
|
|||
|
|||
How to design table for query info I need
On Thu, 23 Oct 2008 13:15:00 -0700, Ladypep13
wrote: 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. -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|