Solved

Query Consecutive Yearly Payments Access 2007

Posted on 2009-04-13
4
312 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 119

Expert Comment

by:Rey Obrero
Comment Utility
what exactly are you trying to do?
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now