G
Guest
I have a form where a user can search by Company and Plan Code, they can
enter criteria in both or leave one blank. The problem I am having is that
if a user searches only by Plan Code, they should see all items matching that
Plan Code no matter what the Company is, even the items with a blank Company.
However, if they enter criteria in the Plan Code and Company fields they
should not see items with a blank Company in the results, only items matching
that company.
But the query I am useing to get my results is not working correctly. I am
using this is my Company Field
IIf([Forms]![frmSearch]![Company Code] Is Null,"*",Like
[Forms]![frmSearch]![Company Code] & "*")
I think there is a problem with the true segment because if I leave Company
blank on the form I get zero results.
I have also tried
IIf([Forms]![frmSearch]![Company Code] Is Null,[Company Code],Like
[Forms]![frmSearch]![Company Code] & "*")
If Company is left blank I get all records that don't have a Null Company
however, I do not get records with a Null Company.
Basically what I want is if you enter criteria you will only get results
matching that criteria, however, if you leave a criteria field blank you will
receive all records with something in that fields as well as all records that
are null.
Thanks in advance.
enter criteria in both or leave one blank. The problem I am having is that
if a user searches only by Plan Code, they should see all items matching that
Plan Code no matter what the Company is, even the items with a blank Company.
However, if they enter criteria in the Plan Code and Company fields they
should not see items with a blank Company in the results, only items matching
that company.
But the query I am useing to get my results is not working correctly. I am
using this is my Company Field
IIf([Forms]![frmSearch]![Company Code] Is Null,"*",Like
[Forms]![frmSearch]![Company Code] & "*")
I think there is a problem with the true segment because if I leave Company
blank on the form I get zero results.
I have also tried
IIf([Forms]![frmSearch]![Company Code] Is Null,[Company Code],Like
[Forms]![frmSearch]![Company Code] & "*")
If Company is left blank I get all records that don't have a Null Company
however, I do not get records with a Null Company.
Basically what I want is if you enter criteria you will only get results
matching that criteria, however, if you leave a criteria field blank you will
receive all records with something in that fields as well as all records that
are null.
Thanks in advance.