troubleshooting Question

filter by form - exclude null

Avatar of cwbarrett
cwbarrett asked on
Microsoft Access
11 Comments1 Solution74 ViewsLast Modified:

I have a continuous form with a recordsource having 4 text fields total.  I'll call the recordsource  fields Field1, Field2, ....  In the form header I have 4 fields called field1filter, field2filter, ...   When a header filter field is Null I want to show all records (with respect to that field), null or not null, but when there is text in the respective filter field I want to show only records that are "like" the filter, without the nulls.  If I type text into a second "filter" field, I want to drill down the records to match the 2nd filter criteria as well, only records that match, no nulls with respect to the filtered fields.  So, with text in two of the filter fields I want to show only records that have matching text in their respective fields.

The data is originally pulled from an Excel sheet and put into the record source table but I was extremely diligent with my append queries extracting this data from the Excel sheet to make sure I have Nulls and not zero length fields or spaces instead of text.  I'm aware of the problems that null vs. 0 length or  spaces can cause.

Here is the criteria used in the form's query for the 4 filtered fields:
Field1 criteria:  Like "*" & [Forms]![<formname>]![field1filter] & "*" Or Is Null
Field2 criteria:  Like "*" & [Forms]![<formname>]![field2filter] & "*" Or Is Null
Field3 criteria:  Like "*" & [Forms]![<formname>]![field3filter] & "*" Or Is Null
Field4 criteria:  Like "*" & [Forms]![<formname>]![field4filter] & "*" Or Is Null

Basically, with respect to each filter, if I type text into a header filter I want to show matching records without null values, but if the filter is null, I want to show all records, including nulls.

Hope I explained correctly, any help on this is greatly appreciated.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 11 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 11 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004