View Single Post
  #2  
Old May 27th, 2010, 05:08 AM posted to microsoft.public.access.queries
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Criteria to return all records if selection from form is null

Sue Pari wrote:
Hi,

I'm trying to pass multiple query criteria from form controls. I'm using
the following type of syntax for the criteria:

Like Nz([Forms]![ViewEdit Completed Procedures]![SelectOBy],"*")

And this works fine for the fields where there are no Nulls in the data, but
if there are Nulls in this field I don't get those records. Quite
understandable since Like "*" doesn't return Nulls.

What I'm trying to do is to return all records when there is nothing chosen
in the selection box on the form. I've tried a bunch of different IIfs with
various use of quote marks, on the order of:

IIf(IsNull([Forms]![ViewEdit Completed Procedures]![SelectOBy]),"Not Is Null
Or Is Null",[Forms]![ViewEdit Completed Procedures]![SelectOBy])

but they either don't get all the records or they kick a "too complex"
error.

I'm sure this must be easier than I'm making it. Could anyone give me some
help?

Thanks in advance,

Sue


I would probably build the filter on the fly (in the click event of a button)
and then pass the filter you build to a form/report when you open it. There
are some examples of filtering reports by using listbox controls etc on
accessweb. http://www.mvps.org/access/forms/frm0007.htm

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/201005/1