SDRichardC
Technical User
I am trying to count distinct or unique numbers from a field named Order. I have build the queries within queries but not sure how to make it work. I put the SQL code into the first query and it gave me an error such Circular Referece caused by OMOrder. What is wrong? Can someone help, please. Thanks in advance.
Here is the SQL from the three queries:
Main Query:
---------------------
SELECT VLDataTable.Date, VLDataTable.Shift, VLDataTable.Order, VLDataTable.[Engine Name]
FROM VLDataTable
WHERE (((VLDataTable.Date) Between [Forms]![frmPhoenixDetailQuery]![DateFrom] And [Forms]![frmPhoenixDetailQuery]![DateTo]) AND ((VLDataTable.Order)<>"Sahara" And (VLDataTable.Order)<>"IQ" And (VLDataTable.Order)<>"OTC" And (VLDataTable.Order)<>"N/A"))
ORDER BY VLDataTable.[Engine Name];
---------------------
Second Query:
SELECT OMOrder.Shift, OMOrder.Order, OMOrder.[Engine Name]
FROM OMOrder;
---------------------
Third Query:
---------------------
SELECT OMOrderQuery.Order
FROM OMOrderQuery
GROUP BY OMOrderQuery.Order;
---------------------
What do I need to do to count DISTINCT Order?
Here is the SQL from the three queries:
Main Query:
---------------------
SELECT VLDataTable.Date, VLDataTable.Shift, VLDataTable.Order, VLDataTable.[Engine Name]
FROM VLDataTable
WHERE (((VLDataTable.Date) Between [Forms]![frmPhoenixDetailQuery]![DateFrom] And [Forms]![frmPhoenixDetailQuery]![DateTo]) AND ((VLDataTable.Order)<>"Sahara" And (VLDataTable.Order)<>"IQ" And (VLDataTable.Order)<>"OTC" And (VLDataTable.Order)<>"N/A"))
ORDER BY VLDataTable.[Engine Name];
---------------------
Second Query:
SELECT OMOrder.Shift, OMOrder.Order, OMOrder.[Engine Name]
FROM OMOrder;
---------------------
Third Query:
---------------------
SELECT OMOrderQuery.Order
FROM OMOrderQuery
GROUP BY OMOrderQuery.Order;
---------------------
What do I need to do to count DISTINCT Order?