Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 326
  • Last Modified:

Query Consecutive Yearly Payments Access 2007

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
forcefeeld
Asked:
forcefeeld
1 Solution
 
Rey Obrero (Capricorn1)Commented:
what exactly are you trying to do?
0
 
Patrick MatthewsCommented:
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
 
TextReportCommented:
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
 
forcefeeldAuthor Commented:
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now