"If the user enters something, return something, otherwise return everything"

"If the user enters something, return something, otherwise return everything"

Post by Chris Mort » Tue, 07 Sep 2004 22:35:40


I need a expression for a query thinger. The database
has 4 possible values for a field called "Voltage", these
values are 11, 33, 0 or NULL (NULL being actually
nothing, not the word "NULL"). I want a query that will
ask the user for an input and if they enter something
(say, 33), it will show whatever they ask for (like all
the 33s), otherwise show everything. I can get it to
filter everything OK (to just show my 33s and such like),
however the problem I am having is when the user enters
nothing, as the records that have a NULL voltage are not
being shown. Any ideas anyone?

Sorry if this makes no sense, this has been bugging me
for hours and I'm a smudge stressed.

Thanks,

Chris
 
 
 

"If the user enters something, return something, otherwise return everything"

Post by MV » Tue, 07 Sep 2004 23:27:06

Set it up as follows.

Field: Voltage
Criteria: [Enter Voltage] OR [Enter Voltage] is Null

When you save this, Access will restructure it so the next time you open it, it
will look different but it should still work. Be warned that this technique
will fail if there are too many criteria in the query.