I have a problem with my query that is picking out a record not in the criteria. Or it's a bug in Access?
Here's the SQL
The wierd part is, if I change the criteria to
it will work.
PO.PONUM = Primary key
Inventory.STOCKID is not PK, index(no Dulplicate)
POLINE.PONUM is not PK, index,(no Dulplicate)
The problem is, it is picking out a record that is not in my criteria "HAVING (((POLINE.PONUM)=471)" but a record in PO.PONUM = 470! The PO.PONUM=470 have a status = "APPR" and had a single record in the table POLINE.
What's wrong? I can't figure it out.
Thanks.
Here's the SQL
Code:
SELECT Inventory.CURBAL, Inventory.[UNIT PRICE], PO.PONUM, POLINE.PONUM, POLINE.STOCKID, PO.STATUS, POLINE.QTY
FROM (PO INNER JOIN POLINE ON PO.PONUM = POLINE.PONUM) INNER JOIN Inventory ON POLINE.STOCKID = Inventory.[STOCK NO]
GROUP BY Inventory.CURBAL, Inventory.[UNIT PRICE], PO.PONUM, POLINE.PONUM, POLINE.STOCKID, PO.STATUS, POLINE.QTY
HAVING (((POLINE.PONUM)=471) AND ((POLINE.STOCKID) Like "XX*") AND ((PO.STATUS)="WAPPR")) OR (((PO.STATUS)="APPR"));
The wierd part is, if I change the criteria to
Code:
AND ((PO.STATUS)="APPR")) OR (((PO.STATUS)="WAPPR"));
PO.PONUM = Primary key
Inventory.STOCKID is not PK, index(no Dulplicate)
POLINE.PONUM is not PK, index,(no Dulplicate)
The problem is, it is picking out a record that is not in my criteria "HAVING (((POLINE.PONUM)=471)" but a record in PO.PONUM = 470! The PO.PONUM=470 have a status = "APPR" and had a single record in the table POLINE.
What's wrong? I can't figure it out.
Thanks.