Criteria for blank fields (query)

stafire_18

Board Regular
Joined
Dec 8, 2004
Messages
162
I have a table that has a column for addresses. there are some addresses in this field & there are no addresses in this field (blank cells) If I just wanted a query to select the fields that contain an address & not a blank what do I put in the query?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
You can put "Not Is Null" as the criteria of this field.
 
Upvote 0
No address

stafire_18,

Actually using "Not Is Null" in situations like this will eventually find that person who thinks "deleting" an address is the same as making the field appear blank. In other words, sooner or later that perverbial "spacer" will crop up; yes that person who "blanks" the address by highlighting the entire entry and hitting the spacebar.

A better criteria is to ensure Nulls, zero-length string, etc. is handled so you don't have to revisit the query later and try to figure out why this seemingly "blank" address is now showing up is below.

I always use the Trim$([field_name] & " ") <>"" when equating. This then takes care of the Nulls, zero-length strings, etc. all at once. When used as a field in a select query it also eliminates having to also specify Is Null or Not Is Null in the criteria since it already took care of them.
 
Upvote 0

Forum statistics

Threads
1,221,905
Messages
6,162,770
Members
451,786
Latest member
CALEB23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top