Starting with no records for a filter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
i have a subform that i filter based on some combo boxes at the top of the
main form that the user can type into.

i have a search method that is called using the following:
call searchMethod(Nz(box1.value, ""), Nz(boz2.value,"") , ..... )

this search method then builds up an sql string to filter the records. this
works well.

when i initially load the form up, i have a minor problem. all of the
records are shown, because all of the box values are "", and so there is
effectively no filter.

i actually want the opposite of this. i.e if the user doesnt select
anything, then i want no records to be shown at all.

SOME of the boxes can be null at any one time, just not all of them.

is there a way that i can say "if all of the boxes are null, dont return any
records" with a filter?

thanks as always,
ben
 
is there a way that i can say "if all of the boxes are null, dont return any
records" with a filter?

Sure. Just have the default Filter property set to

False

A filter is an expression evaluated for each record; if the expression
evaluates to TRUE the recored is displayed, and if it evaluates to FALSE it
isn't. So having a filter which always returns false returns no records.

John W. Vinson [MVP]
 
Back
Top