Do you have a table that contains all the inspectors? You should have
in all probability.
Assumption: Table Named Inspectors with one record for each inspector.
You will need two queries.
The first query is the one you have now.
SELECT Inspectors.InspectorID, NZ(CountOfID2007,0) as TheCount
FROM Inspectors LEFT JOIN [Your Current Query]
ON Inspectors.InspectorID = [Your Current Query].InspectorID
Basically in design view
-- Add the Inspectors table and the existing query
-- Drag for InspectorID to InspectorID to set up the join
-- Double-click on the join line and select the option that shows ALL
records in the Inspector table and only matching in the query
-- Add the InspectorID field from the Inspectors table
-- Add the count from your current query.
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
I'm sorry for the confusion, below is the actual query. I will try to explain
better
SELECT [2007 March].InspectorID, Count([2007 March].ID2007) AS CountOfID2007
FROM [2007 March]
WHERE ((([2007 March].[DATE INSP DONE])>=[Forms]![Report Access
Form]![StartDate] And ([2007 March].[DATE INSP DONE])<=[Forms]![Report Access
Form]![EndDate]))
GROUP BY [2007 March].InspectorID;
The results are below;
InspectorID Count
Inspector 1 1
Inspector 2 12
Inspector 3 3
Inspector 4 4
I would like show all inspectors even when null value exist for the date
parameter.
John Spencer said:
Well, first post the actual query. What you have posted would never
work. Hint on the menubar View: SQL to see the real SQL.
You refer to [In Tbl], [2007 tbl], [2007 tbl ], [2000 tbl], and [tbl
March] in the posted SQL but have only [2007 tbl ] in the FROM clause.
Next, if there are no records returned by a query then you can't display
zero.
If you mean you want the records in a specific table from the tables you
used in the query (i.e., [2007 tbl]) returned then you would need to use
an outer join (either a LEFT JOIN or a RIGHT JOIN) to various other
tables you want to use in your query.
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
B wrote:
How can i display all names in the table even when there are no records that
meet the parameter? When there are no records i want to show 0 not null ?
Thanks
SELECT [In tbl].name, [2007 tbl].ID2007, [2007 tbl].[HOUSE NUMBER], [tbl
March].STREET, [tbl March].UNIT, [tbl March].[ZIP CODE], [tbl March].[Cc
filed date]
FROM [2007 tbl ]
WHERE ((([2000 tbl].[Cc filed date])>=[Forms]![Report Access
Form]![StartDate] And ([2007 tbl].[Cc filed date])<=[Forms]![Report Access
Form]![EndDate]))
ORDER BY [In tbl].name;