T
Tony Williams
I have a query that counts records of various types . Here is the sql
SELECT Count(tblComplaints.txtcompnbr) AS CountOftxtcompnbr,
DCount("[txtcompnbr]","tblcomplaints","[txtwithdrawn]=-1") AS [Count of
withdrawn], DCount("[txtcompnbr]","tblcomplaints","[txtcompcom]=-1") AS
[Count of Complaints Comm],
DCount("[txtcompnbr]","tblcomplaints","[txtintproc]=-1") AS [Count of
Internal], DCount("[txtcompnbr]","tblcomplaints","[txttype]='members'") AS
[Count of members],
DCount("[txtcompnbr]","tblcomplaints","[txttype]='solicitors'") AS [Count of
solicitors], DCount("[txtcompnbr]","tblcomplaints","[txttype]='Defendants'")
AS [Count of Defendants],
DCount("[txtcompnbr]","tblcomplaints","[txttype]='Debt Recovery Firms'") AS
[Count of Debt Recovery Firms], tblComplaints.txtdaterecd
FROM tblComplaints
WHERE (((Nz([txtcompnbr],""))<>""))
GROUP BY tblComplaints.txtdaterecd;
However I want all the count calculations to only count records where the
value of txtcompnbr is not Null. At the moment it is counting all records
for each type whether there is a value in txtcompnbr or not.
Help would be appreciated
Thanks
Tony
SELECT Count(tblComplaints.txtcompnbr) AS CountOftxtcompnbr,
DCount("[txtcompnbr]","tblcomplaints","[txtwithdrawn]=-1") AS [Count of
withdrawn], DCount("[txtcompnbr]","tblcomplaints","[txtcompcom]=-1") AS
[Count of Complaints Comm],
DCount("[txtcompnbr]","tblcomplaints","[txtintproc]=-1") AS [Count of
Internal], DCount("[txtcompnbr]","tblcomplaints","[txttype]='members'") AS
[Count of members],
DCount("[txtcompnbr]","tblcomplaints","[txttype]='solicitors'") AS [Count of
solicitors], DCount("[txtcompnbr]","tblcomplaints","[txttype]='Defendants'")
AS [Count of Defendants],
DCount("[txtcompnbr]","tblcomplaints","[txttype]='Debt Recovery Firms'") AS
[Count of Debt Recovery Firms], tblComplaints.txtdaterecd
FROM tblComplaints
WHERE (((Nz([txtcompnbr],""))<>""))
GROUP BY tblComplaints.txtdaterecd;
However I want all the count calculations to only count records where the
value of txtcompnbr is not Null. At the moment it is counting all records
for each type whether there is a value in txtcompnbr or not.
Help would be appreciated
Thanks
Tony