Skip to content
Advertisement

MSACCESS returning NULL values where textbox = “blank”

I have a search query that returns values from textboxes. I want to add the functionality to return all rows where Comments is null or empty.

I have tried editing the SQL to accept “blank” in the textbox and return all the rows where comments is null. I just added the OR to the original portion of the code.

or

When I search “blank”, I receive no results.

Advertisement

Answer

Null and an empty string ("") are two different values.

I’m guessing you’ll want to use something like this:

This means:

  • If the user types “Blank” then records with no comments are returned.
  • If the user leaves the comments field blank, then all records are returned (no filter).
  • Else the comments are wildcard matched with the user entry.
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement