I'm just not sure why this is giving me so many problems. I would think it would be quite easy!
I am running a query from a selection on a form. I want to be able to select data based on what shop works a product.
Here is a copy of the SQL. The problem I have is in the WHERE section:
In the IIF section on the WHERE statement right now I get an error and the code does not run. If I select (from the combo41 box) REW or DAV it works as I need, but if I select "ALL" I cannot get anything back...
Any ideas??
I am running a query from a selection on a form. I want to be able to select data based on what shop works a product.
Here is a copy of the SQL. The problem I have is in the WHERE section:
Code:
INSERT INTO [Enterprise Report Card] ( LRU, NSN, Repaired )
SELECT lru.Abbr, lru.NSN, Sum(IIf(work!status=4 And work!code=11 And work![tin date] Between DateSerial(Year(forms![enterprise report card].combo31),Month(forms![enterprise report card].combo31),1) And DateSerial(Year(forms![enterprise report card].combo31),Month(Forms![enterprise report card].combo31)+1,0),1,0)) AS Repaired
FROM Area INNER JOIN (lru INNER JOIN [Work] ON lru.ID = Work.[LRU ID]) ON Area.ID = lru.Team
WHERE (((Area.name)=IIf([forms]![enterprise report card].[combo41]="All",([Area].[name])="REW" Or ([Area].[name])="DAV",[forms]![enterprise report card].[combo41])) AND ((lru.Enterprise)=True))
GROUP BY lru.Abbr, lru.NSN;
In the IIF section on the WHERE statement right now I get an error and the code does not run. If I select (from the combo41 box) REW or DAV it works as I need, but if I select "ALL" I cannot get anything back...
Any ideas??