Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wild Card in Criteria from form 2

Status
Not open for further replies.

ztm

IS-IT--Management
Jul 19, 2001
34
US
Please help!
I've been struggling with this for an eternity! I have a query that gets its search criteria from a combo box on a form. I'm trying to make it so that if the user selects an item in the combo box, the query returns results based on that item. But, if they leave the combo box empty, all records are returned. The query works if I select an item, but if I don't, I get zero records returned. This is what I have in the criteria field.

IIf(IsNull([Forms]![formname]![Combo]),"*",[Forms]![formname]![Combo])

I've tried all kinds of variations of the wildcard using the words Null, like, etc. and all I get is zero records returned.
 
try adding a new column to your query as follows:

in the FIELD box type: IIf(IsNull([Forms]![form1]![Combo])=False,[YourFieldNameHere]=[Forms]![form1]![Combo],[YourFieldNameHere] Like "*")

unclick the SHOW box and set your CRITERIA to <>False

 
You are a GOD! I would have never thought of doing it that way. It worked perfectly. Thanks very much!
 
I know this is a old post but this is a little bit like what I am tring to do.

I have use this technique to filter a from using several combo boxes.

After filling up the combo box and clearing then. I get:

The applyfilter action was cancelled. Erro code

So I get out of the form and get in and every thing works again.

Strange!!!!

I would use help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top