We help IT Professionals succeed at work.
Get Started

filter by form - exclude null

cwbarrett
cwbarrett asked
on
72 Views
Last Modified: 2016-02-25
Hi:

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.

Charlie
Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE