A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to design table for query info I need



 
 
Thread Tools Display Modes
  #1  
Old October 23rd, 2008, 09:15 PM posted to microsoft.public.access.tablesdbdesign
Ladypep13
external usenet poster
 
Posts: 6
Default 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  
Old October 23rd, 2008, 10:58 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old October 23rd, 2008, 11:01 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.