Ignore search field if left blank causing me issues.

dopy

New member
Local time
Today, 01:07
Joined
Oct 5, 2016
Messages
7
So I have a multifield search form that searches the database.

I have fields that if left blank will be ignored (or rather, display all results).

However, I have a field that a person can fill in a number, and it'll display all results from the database that are less than said number. Which works, but I can't for the life of me get it to ignore said field if the user does not enter a value.

Normal text field query:
Code:
Like "*" & [Forms]![SearchF]![BEHEERDER] & "*"

Numeric (less than) field query:
Code:
<[Forms]![SearchF]![AANTAL MAANDEN MINDER DAN]
No matter where I put the Like "*" & &"*" tags it does not work. If I put the as in the normal text field query, it displays me results that have no numeric value in said field. But that's not what I want, if there is no value entered in said numeric field I just want it to ignore it (or rather, display all results regardless of what numeric value they have).

If anyone could help me that would be wonderful...
 
You could try something like
Code:
If IsNumeric(your text box) then
   search for number
else
  nothing was entered
end if
 
You could try something like
Code:
If IsNumeric(your text box) then
   search for number
else
  nothing was entered
end if

Thanks, managed to get it to work by finding another thread on here with the following code:

Code:
IIf(IsNull([Forms]![SearchF]![AANTAL MAANDEN MEER DAN]);True;[aantal maand test]>[Forms]![SearchF]![AANTAL MAANDEN MEER DAN])

and
Code:
<>False
in criteria.
 

Users who are viewing this thread

Back
Top Bottom