query criteria if null then like "*"

mcfadwmc

Board Regular
Joined
May 10, 2005
Messages
162
I have a query (lossdata) where i want the user to be able to set the criteria for the results

so i have a table called 'chooser' which has one record of several combobox's which will display the same data as is in the respective columns in the query

if the user selects one of the options in the combo box then i want the query criteria for the respective column to be equal to that but if it is null then show all values in that column

so i thought the query criteria in the product column would be something like

like iif([chooser]![product]isnull,"*",[chooser]![product])

but it doesn't work so i tried

iif([chooser]![product] is null, like "*",like [chooser]![product])

but that does't work so i tried

iif([chooser]![product] is null,[lossdata]![product]like "*",[lossdata]![product]like[chooser]![product]

still doesn't work.

any help would be much appreciated as i thought i had finally got my head around access by doing this but it seems i haven't
 
Biggest thanks to mcfadwmc and other participants of this thread! I had 100% the same case and was deadly stuck. You've helped me vvery much! :pray::pray::pray:
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,205
Messages
6,123,634
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top