Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

easy question....

Status
Not open for further replies.

Dre313

Technical User
Jun 4, 2003
219
US
I fergot how to count all null field in a query...

First I'm tryin to get all "Y" in a yes no field ... so in my query I add my table then add my field .. i put the letter Y in the criteria.. and it pulls all "Y" yes for that field...

Next I add in my date field.. which pulls all dates with "Y" in it..
some of those fields are blank..

I want to run a count of how many fields are blank in my date field...

I want to return a number of how many are blank..

I know you do a count of IsNULL in the criteria.. but i fergot how.. could someone enlighten me??

thanks
 
On the criteria line for your date field just type
Is Null

with the space in between. That will do it.

Paul
 
Yes.. and it returns all blank dates.. but is there a way i can count how many are blank.. and give me that number ?

thanks for the response..
 
As you have probably seen, you get 0 trying to count null fields. You have to count a field with values "Where Date Is Null".
Here's some sample SQL

SELECT Count(tblResults.Attempts) AS CountOfAttempts
FROM tblResults
WHERE (((tblResults.Date) Is Null));


Paul
 
thanks paul i'll try this.. one thing.. what is attempts ?

tblResults.. would be my table
Date .. would be my date field..
Attempts ??
CountofAttempts ??

thanks
 
Well, Attempts is a field in my table,tblResults, that has data in all the records where the Date field Is Null

As I said, you have to count a field with values in it 'Where the date field is Null' in order to get an accurate Count. It could look like this.

SELECT Count(tblResults.Attempts) AS CountOfNullDates
FROM tblResults
WHERE (((tblResults.Date) Is Null));


Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top