How not to count empty fields in query

Aruce

New member
Local time
Today, 01:52
Joined
Jul 19, 2011
Messages
1
Hello everybody,
I must say that i just recently started working with access 2010 (and databases in general) so I need help.
There is a huge table with some 150 rows of data, now I know how to select data. What I want to do is count the number of entries in each row, but to exclude the empty fields (ones with null value), so i count only the ones with data in. There is an ID and DATE field that i use to filter for what period i want the rows calculated, but i always get all the fields counted even if threre are empty ones without data.

this is what i got so far (counting the rows 24, and 25)

SELECT Count(24) AS REC, count(25) AS REC_K
FROM anketa
WHERE (((anketa.id)=[ID]) AND ((anketa.date)>=[From] And (anketa.date)<=[To]));


Thank you.
 
I agree with jdraw. The way you have your table setup isn't really efficient.

But to count what you have in the current table setup.

You would want to setup a query (use design view) and select the table.

Then select the fields (i would put the date first so you can set your criteria) then place all of your fields in the row and click on total. This should give you the Group by option. Now change every single one of your field to Count except for date. Leave it as Where.
Hope this helps.
 

Users who are viewing this thread

Back
Top Bottom