Re: True, False, or All



My original statement was incorrect. The user needs the option to select TRUE,
FALSE, or ALL.
The records will be filtered if TRUE or FALSE. When ALL is selected all of
the records are shown.

Michel Walsh wrote:
Write a dynamic query: Build a string which will represent the SQL statement
to be executed, without the filter you don't want to apply, then, assign
that string to a record source, or as argument of a recordset, or as it fits
in your case.

Alternatively, use a sequence of AND and OR, like:

WHERE ( (NOT FilterOneIsActive) OR Field1 = valueForFilterOne )
AND ( ( NOT FilterTwoIsActive) OR Field2=valueForFilterTwo)
AND ...

which can be shortened a little bit, using IMP, to:

WHERE ( FilterOneIsActive IMP field1 = valueForFilterOne )
AND ( FilterTwoIsActive IMP field2 = valueForFilterTwo )
AND ...

but these generic solutions will be slower than the dynamic query.

Vanderghast, Access MVP

I have a query that I want to run from a form. If you select All for each
field (yes/no fields) it will filter for those values. If I select All how
do
I make it not filter?

.



Relevant Pages

  • Re: How to compile filter in VC2005
    ... registered because they linked to incorrect version msvcr80.dll,so anyone can ... tell me how to compile filter under VC2005? ... You have the choice of installing ... separate folder with your filter. ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: FILTER SUBFORM VIA COMMAND BUTTON
    ... The error message indicates that the Filter string is incorrect. ... what kind of field is ReceiptID? ... to the main form and also to the subform. ...
    (microsoft.public.access.forms)
  • Re: Exception Handling - help!
    ... I was under the impression (incorrect, ... > filter it terminates the that stack walk and treats that as if the filter ... Best regards, George ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Removing the bellwire
    ... Blah Blah Blah wrote ... The filter will have the replacement ring capacitor circuit although ... The point is that most filters will have the filter so suggesting that it will make no difference to the OP original problem is incorrect. ...
    (uk.telecom.broadband)
  • Re: Socializing multiple dogs
    ... not by Paul) for situations like this one. ... My killfile actually is a filter; I guess I use the terms ... interchangeably, which is incorrect. ...
    (rec.pets.dogs.behavior)