Your subquery's SQL statement is incomplete. Here is what I posted in my
suggestion (I've excerpted the part for the comparison for PROID):
A.[PROID] = (SELECT Max(T.[PROID])
FROM YourTableName AS T
WHERE T.[WOID] = A.[WOID]);
Here is what you have:
(([tblProcNested-Non].PROCID)=(SELECT
Max([tblProcNested-non].PROCID)));
Notice what is missing after the "Max" part of the statement --you do not
specify the table from which the data are to be drawn, nor do you use the
WOID value to filter the data set in the subquery.
Also, you must use an alias for the tablename in the subquery's SQL
statement so that the query knows you're not using the exact same data set
in the subquery as in the main query. Look again at the posted example I
provided. I am using A as the alias for the table in the main query, and T
as the alias for the table in the subquery.
Therefore, a revised query statement would be something like this:
SELECT tblPNNested.Cert, tblWorkorder.WOID, [tblProcNested-Non].[Item#],
[tblProcNested-Non].Desc, [tblProcNested-Non].Thick,
[tblProcNested-Non].Area, [tblProcNested-Non].PNID,
[tblProcNested-Non].PROCID
FROM tblPNNested INNER JOIN (tblWorkorder INNER JOIN [tblProcNested-Non] ON
tblWorkorder.WOID = [tblProcNested-Non].WOID) ON (tblWorkorder.WOID =
tblPNNested.WOID) AND (tblPNNested.[Item#] = [tblProcNested-Non].[Item#])
WHERE (((tblPNNested.Cert)=-1) AND ((tblWorkorder.WOID)=28289) AND
(([tblProcNested-Non].PROCID)=(SELECT Max(T.PROCID
FROM [tblProcNested-non] AS T WHERE
T.[WOID] = [tblWorkorder].[WOID])));

Signature
Ken Snell
<MS ACCESS MVP>
> Hi Ken,
> Here's my exact statement which I get an syntax error on:
[quoted text clipped - 38 lines]
>> > Thank You
>> > Grant
Ken Snell (MVP) - 27 May 2006 21:57 GMT
Sorry, inadvertently omitted a parenthesis. Try this:
SELECT tblPNNested.Cert, tblWorkorder.WOID, [tblProcNested-Non].[Item#],
[tblProcNested-Non].Desc, [tblProcNested-Non].Thick,
[tblProcNested-Non].Area, [tblProcNested-Non].PNID,
[tblProcNested-Non].PROCID
FROM tblPNNested INNER JOIN (tblWorkorder INNER JOIN [tblProcNested-Non] ON
tblWorkorder.WOID = [tblProcNested-Non].WOID) ON (tblWorkorder.WOID =
tblPNNested.WOID) AND (tblPNNested.[Item#] = [tblProcNested-Non].[Item#])
WHERE (((tblPNNested.Cert)=-1) AND ((tblWorkorder.WOID)=28289) AND
(([tblProcNested-Non].PROCID)=(SELECT Max(T.PROCID)
FROM [tblProcNested-non] AS T WHERE
T.[WOID] = [tblWorkorder].[WOID])));

Signature
Ken Snell
<MS ACCESS MVP>
> Your subquery's SQL statement is incomplete. Here is what I posted in my
> suggestion (I've excerpted the part for the comparison for PROID):
[quoted text clipped - 77 lines]
>>> > Thank You
>>> > Grant
Grant - 28 May 2006 01:26 GMT
Thanks Ken..
I didn't understand the alias..
Works perfect..
Grant
> Sorry, inadvertently omitted a parenthesis. Try this:
>
[quoted text clipped - 91 lines]
> >>> > Thank You
> >>> > Grant