Access IIF Statement? (or maybe a "group by") query

jschlapi

New Member
Joined
Aug 8, 2008
Messages
49
Below is a portion of an Access query result I am working with:

Dig ID Address Date Purpose Equipment used
2 131 Frontier 08/08/2015 Main Repair Backhoe
2 Dump Truck
2 Vactor

3 555 Windy Rd 07/04/2016 Valve Repair Backhoe
3 Utility truck

I want to try to capture only year 2015 for my report. Does anyone know how I can write an if statement in Access that will essentially say: If date = 2015 AND if Dig ID is the same as the line above, then I want it in my result.
I tried to GROUP BY Dig ID # but the only line I can see in my report is the single row that has the date.

Thank you for your time & advice.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
That is bad design. According to the Rules of Normalization, each record should be complete and independent of other records in the table. You may be able to work with it, but simple tasks (like this) are made to be much more difficult than they have to be because of the design.

See this for details on Normalization Rules: https://support.microsoft.com/en-us/kb/100139

If you are "stuck" with this design, here is how I would go about it:

1. Create a query that returns just the Dig ID and Date fields, and just returns the 2015 dates, i.e.
Year([DateField]) = 2015

2. Now, create a second query which links your main data table and the query you created above on the Dig ID field, and return all the fields that you want from the main data table.
That will return records for any Dig ID with a 2015 date.
 
Upvote 0
Thank you so much!! Your idea worked & it will get me thru to at least finish this, but I will definitely check out the link. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,267
Messages
6,123,964
Members
449,137
Latest member
yeti1016

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