itsaboutcode
itsaboutcode

Reputation: 25099

Getting All Records where Particular Column is empty in Access

I am writing a query in Access where I have to get all the records where a particular column is empty, how I can do this?

This is what I am thinking it should be, but its not working.

SELECT *
FROM TABLE
WHERE PARTICULARCOLUMN = ''

Upvotes: 5

Views: 36257

Answers (3)

aharown07
aharown07

Reputation: 166

In my case, I wanted to find all records with a particular field empty. Not NULL didn't work. This did: WHERE ((Not (table.field)="").

So, to find both the empties and the nulls, just to be sure...

WHERE (((table.field)="" Or (table.field) Is Null)

Upvotes: 0

Joe Stefanelli
Joe Stefanelli

Reputation: 135739

This would handle both empty strings ('') and NULL values in the column.

SELECT *
FROM TABLE
WHERE Nz(PARTICULARFIELD,'') = ''

Upvotes: 14

John K.
John K.

Reputation: 5474

Try...

WHERE PARTICULARFIELD Is Null 

Sample from Web:

SELECT [Table1].[CustomerID], [Table2].[CustomerID]
FROM [Table1] LEFT JOIN [Table2] ON [Table1].[CustomerID] = [Table2].[CustomerID]
WHERE ((([Table 2].[CustomerID]) Is Null));

See: http://www.fabalou.com/access/Queries/isnullquery.asp

Upvotes: 7

Related Questions