I have the following query (qryMaterials)
This has no problem.
I need another sql to be used as a rowsoruce of a combo box:
This one throws ODBC-- call failed.
I tried to use a subquery :
Still ODBC error.
Using an aggregate query works:
Is there any explanation on why I can not use Distinct?
thanks.
SQL:
SELECT
p.DrawingNo,
o.RecID
.....
TempVars!UsedMaterial_SetCount * o.Quantity * u.UsedQuantity AS Quan,
.....
FROM
(tblOrders AS o
INNER JOIN tblProducts AS p ON o.OrderProductFK = p.ProductPK)
INNER JOIN tblMaterials AS u ON p.ProductPK = u.UsedProductFK
WHERE
u.LaNc="NC"
ORDER BY
u.ProgramNo;
This has no problem.
I need another sql to be used as a rowsoruce of a combo box:
SQL:
SELECT DISTINCT
DrawingNo
FROM
qryMaterials
WHERE
RecID IN ('S1024120001','S1024120002','S1024120003','S1024120004');
This one throws ODBC-- call failed.
I tried to use a subquery :
SQL:
SELECT DISTINCT
DrawingNo
FROM
(SELECT DrawingNo FROM qryMaterials) AS SubQ
WHERE
RecID IN ('S1024120001','S1024120002','S1024120003','S1024120004');
Still ODBC error.
Using an aggregate query works:
SQL:
SELECT
DrawingNo
FROM
qryMaterials
WHERE
RecID IN ('S1024120001','S1024120002','S1024120003','S1024120004')
GROUP BY
DrawingNo;
Is there any explanation on why I can not use Distinct?
thanks.
Last edited: