Full Version: Display Even numbers on the count results of a group of records
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
chippyles
I have a query that counts how many records are within a group. I need to place in the criteria that I want even numbers of counts displayed. How do I do this? Am I limited to the MOD([MyField],2)=0? If so I am not sure how to place this in the criteria of the query. Please help.
ScottGem
Add a column to your query:

EvenCt: Mod([Fieldname],2)

Set the Criteria for that column to 0
fkegley
I got it to work like this:

SELECT Count(Orders.OrderID) AS CountOfOrderID, Orders.CustomerID
FROM Orders
GROUP BY Orders.CustomerID
Having Count(Orders.OrderID) Mod 2 = 0;

Open a new query in Design View. Select NO TABLES. Click the SQL button at the left end of the Toolbar. Copy and paste this into that window. Switch back to Design View.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.