Link to home
Start Free TrialLog in
Avatar of garland29
garland29

asked on

If NotNull then...

I have simple search for where the user checks a check box next to the criteria that they would like to filter by.  But I was wonder if there was a way to remove the check box.  I have tried If Not IsNull but it does not work.  Here is the code that I use.

    If chkLegal = True Then
    If Nz(Forms![frm_Customer_Search]!txtLegalName, "") <> "" Then
        strWhere = "(Legal_Name LIKE '*" & Replace(Forms![frm_Customer_Search]!
        txtLegalName, "'", "''")  & "*') AND "
    End If
    End If
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Hi garland29,

  Not quite sure what your asking here.  Are you saying you'd like to remove the check box (chkLegal) and just use the txtLegalName control?  

Jim.
Avatar of Nestorio
Nestorio

And the where clause seems to be incomplete.

You get something like this:

strWhere = "(Legal_name Like '*yourvalue*') AND"
Avatar of garland29

ASKER

Yes I would like to remove the check box.  But there are about 8 text boxes with different criteria. I would like it to check if there is anything in the text box if not then move on.

G-
so you'd want to filter on a criteria if and only if the criteria is not empty ?

len(txtLegalName)

    returns the length of the txtLegalName field.

if len(txtLegalName) > 0 then
     ....
end if

or you could use IsEmpty( ), IsNull( ), IsNumeric( ) etc
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I love the ones that are staring right back at me;-)  Thanks!!!