Query by Form

Nikopico33

New member
Local time
Today, 23:43
Joined
Feb 1, 2008
Messages
6
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?
 
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
------------------------------------

.
 
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)
 
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!
 

Users who are viewing this thread

Back
Top Bottom