Using * as criteria excludes null values

  • Thread starter Thread starter Pat
  • Start date Start date
P

Pat

I want to allow users to enter criteria in a field on a
form to filter a query by. If I put "Like [forms]!
[formname]![fieldname]" in the criteria row of the query
for the field I want to filter by, entering a specific
value works fine. However, if I enter a star (*) in order
to include all records, null values are excluded. Any
ideas about what the syntax should be in order to include
all records?

Thanks for any help.
 
Instead of having the user enter a * for all records, just have the user
leave the textbox control blank. Then use this criteria expression in the
query:

Like [Forms]![FormName]![TextBoxName] Or [Forms]![FormName]![TextBoxName] Is
Null

--
Ken Snell
<MS ACCESS MVP>

Pat said:
The problem is I have to reference the form where the
user can enter an asterisk or specific data; therefore,
the criteria in the query must include "Like [forms]!
[formname]![fieldname]". If I add "Or Is Null" to the
criteria, then if the user enters a specific value, the
query will include nulls instead of just the rows that
include the specific value entered by the user.
-----Original Message-----
Like "*" Or Is Null

--
Ken Snell
<MS ACCESS MVP>

Pat said:
I want to allow users to enter criteria in a field on a
form to filter a query by. If I put "Like [forms]!
[formname]![fieldname]" in the criteria row of the query
for the field I want to filter by, entering a specific
value works fine. However, if I enter a star (*) in order
to include all records, null values are excluded. Any
ideas about what the syntax should be in order to include
all records?

Thanks for any help.


.
 
Back
Top