Did not ask you earlier, but am assuming that there will be no duplication of "WorkNo" against a particular "ProjectNo".
If there is a possibility, then ignore / try modifying logic of below :
Just check out if below gives some guidelines :
Save below as sub-query qryWoType :
Code:
SELECT
myTable.ProjectNo,
myTable.WoType
FROM
myTable
WHERE
(
(
(myTable.WoStatus)="A" Or (myTable.WoStatus)="B"
)
)
GROUP BY
myTable.ProjectNo,
myTable.WoType
HAVING
(((myTable.WoType)="X" Or (myTable.WoType)="Y" Or (myTable.WoType)="Z" Or (myTable.WoType)="S"));
Run this as final query :
Code:
SELECT
qryWoType.ProjectNo,
Count(qryWoType.WoType) AS CountOfWoType
FROM
qryWoType
GROUP BY
qryWoType.ProjectNo
HAVING
(((Count(qryWoType.WoType))>=4));
You can check what is happening if something goes wrong, by running the sub-query seperately & taking a look at the results.
Thanks