selecting with like and * doesn't show nulls

JohnGo

Registered User.
Local time
Today, 05:04
Joined
Nov 14, 2004
Messages
70
I'm using two pop-up search forms to give my users search possibilities.
The forms refer to a query with Like criteria. The odd thing, when I use the *-sign all values are returned except null values, in this way I'm missing a lot of records if one field is null.

Does anybody know an alternative sign to be used to * which also selects null values?

example:

code : * name : *

returns all records with a code and a name
what i want is all records even when code is blank and/or name is blank

To add Null within criteria is not an option as users might be selecting more specific things like;
code : ki* name: *art*
for such a search no nulls should be given

I thought about adding an Iif in the criteria and a checkbox beneath each field to include nulls, but maybe there's an alternative sign to be used
 
John,

The syntax is:

Code:
Select *
From   YourTable
Where (SomeField Like '*' & Forms![SomeForm]![SearchString] & '*' And
       Forms![SomeForm]![SearchString] Is Not Null) Or
      (Forms![SomeForm]![SearchString] Is Null)

Expressing that in the query grid will probably require two columns.

Wayne
 

Users who are viewing this thread

Back
Top Bottom