Solved

Query Consecutive Yearly Payments Access 2007

Posted on 2009-04-13
4
317 Views
Last Modified: 2013-11-29
I have an Access 2007 database which contains a list of donations by our patrons.  I need to pull a list of donors by account number who have made annual donations in consecutive years of a hundred dollars or more.

The screen shot shows my data from Table1 .  I have only managed to pull out the people who have made donations>= 100 dollars.  RACCOUNT is the account number, RYEAR=year donation was made, and Donation_Total is the total donations made that year.

Anyways, i've tried creating an extra year field and using count functions but I'm really at a loss of where to start this,   Any help would be appreciated, ty!
screenshot.JPG
0
Comment
Question by:forcefeeld
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 24131685
what exactly are you trying to do?
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 24131785
Hello forcefeeld,

This query will pull consecutive years with >=100...

SELECT t1.RACCOUNT, t1.RYEAR, t2.RYEAR AS PriorYear, t1.Donation_Total, t2.Donation_Total AS PriorTot
FROM table1 t1 INNER JOIN
      table1 t2 ON t1.RACCOUNT = t2.RACCOUNT And t1.RYEAR = (t2.RYEAR + 1)
WHERE t1.Donation_Total >= 100 And t2.Donation_Total >= 100

Regards,

Patrick
0
 
LVL 28

Expert Comment

by:TextReport
ID: 24131957
I see from your NavigationBar that you have created a crosstab query called 01_Donation_History_Crosstab, from this you can create a query on the crosstab and have the YEAR Total fields available and then it is just a case of putting the criteria against the years you are interested in.

BTW You may wish to use FIXED COLUMN HEADIONGS in the Crosstab soecifying the years you want and ensuring they are all available despite any other selection criteria you put in the query.

Cheers, Andrew
0
 

Author Closing Comment

by:forcefeeld
ID: 31569605
Thanks! worked like a charm!  Even better, you got it to list both payments that are consecutive, so i was able to check its validity with the original data.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question