Help pulling multiple years multiple projects

DEllis

Active Member
Joined
Jun 4, 2009
Messages
344
Office Version
  1. 365
Platform
  1. Windows
Here is the situation. I have an access database with a table that has projects, some of which have information in consecutive years in two and some only have in one year. What I am trying to do is pull previous and current year, current and next year and just current year projects. I do not want projects that were from last year and ended in last year. If the project was started last year it may have carried over to this year and therefore can still be edited. Those projects that are only last years, I don't want to pull in when the dashboard is opened.

I need help. I've tried all types of creative queries and can't seem to hit the nail on the head.

Here is an example of the data.

Pro_Num Year Data
1 2010 ABC
2 2010 ADX
2 2011 ADX
3 2011 CFG
4 2011 GHI
4 2012 HGI
5 2012 ZZZ


So you see, what I would like to pull when the project owner opens up his/her dashboard is only those projects that are from the previous year that rolled over to current year, those that are only in the current year, and those that are in the current year with carry over in next year. So from this list the query would pull in projects 2 3 4 but not 1 and 5. 5 would be pulled in next year as would 4, but not the rest.

Is there a way to do this?! ::Scratching head, losing hair:: Please help!!!:confused:
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This

Code:
SELECT tblProjects.Pro_Num, tblProjects.Year, tblProjects.Data
FROM tblProjects
WHERE (((tblProjects.Pro_Num) In (SELECT Pro_Num FROM tblProjects WHERE Year=2011)));
retrieves this
<TABLE border=1 cellSpacing=0 bgColor=#ffffff><CAPTION></CAPTION><THEAD><TR><TH bgColor=#c0c0c0 borderColor=#000000>Pro_Num</TH><TH bgColor=#c0c0c0 borderColor=#000000>Year</TH><TH bgColor=#c0c0c0 borderColor=#000000>Data</TH></TR></THEAD><TBODY><TR vAlign=top><TD borderColor=#c0c0c0 align=right>2</TD><TD borderColor=#c0c0c0 align=right>2010</TD><TD borderColor=#c0c0c0>ADX</TD></TR><TR vAlign=top><TD borderColor=#c0c0c0 align=right>2</TD><TD borderColor=#c0c0c0 align=right>2011</TD><TD borderColor=#c0c0c0>ADX</TD></TR><TR vAlign=top><TD borderColor=#c0c0c0 align=right>3</TD><TD borderColor=#c0c0c0 align=right>2011</TD><TD borderColor=#c0c0c0>CFG</TD></TR><TR vAlign=top><TD borderColor=#c0c0c0 align=right>4</TD><TD borderColor=#c0c0c0 align=right>2011</TD><TD borderColor=#c0c0c0>GHI</TD></TR><TR vAlign=top><TD borderColor=#c0c0c0 align=right>4</TD><TD borderColor=#c0c0c0 align=right>2012</TD><TD borderColor=#c0c0c0>HGI</TD></TR></TBODY><TFOOT></TFOOT></TABLE>

hth,

Rich
 
Upvote 0

Forum statistics

Threads
1,214,787
Messages
6,121,569
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top