View Full Version : Query by Form


Nikopico33
02-26-2008, 12:04 AM
Hi!

I spend a couple of hours searching for this, but I can not find it or even I don't know if it is possible.

I have a query based on inputs from a form (textbox).

I want that:
1) If i put any value in the txtbox, the query show the results for that
2) If I don't put any value in the textbox the query show me only the NULL value and empty ones. (not all values).

What should I write in the criteria to do this?

Jon K
02-26-2008, 04:39 AM
Type this criteria in a new column in the query grid (replacing with the correct field name, form name and text box name):-

------------------------------------
Field: IIf([Forms]![FormName]![TextBoxName] Is Not Null, [FieldName]=[Forms]![FormName]![TextBoxName], [FieldName] Is Null)

Show: uncheck

Criteria: True
------------------------------------

.

Nikopico33
02-26-2008, 05:28 AM
Hi Jon,

Thanks a lot for your reply!

I've done your sugestion but it show only the NULL value. I also want to show the EMPTY fields, so the result when [FieldName] is Null it shows the NUL and the empty fileds. How do I do this?

Expr1: IIf([Forms]![frmCAR]![txtuser] Is Not Null,[user]=[Forms]![frmCAR]![txtuser],[user] Is Null)

Nikopico33
02-26-2008, 11:44 AM
I got it!

Here is what I have done:

IIf([Forms]![frmCAR]![txtuser] Is Not Null,[user]=[Forms]![frmCAR]![txtuser],[user] Like "" Or [user] Is Null)

Only need ot add the [user] Like""...

Thanks!