Search code examples
ms-access-2016

Filter a Query based on multiple combo boxes but if combo box is blank show All records including empty,


I have a form and a list box what is filter with the criteria when the user is selecting from Combo Boxes.

And the record source from the list box is a query so i want to filter the query

I have used this code in query designer Like " * " & [Forms]![Costumers]![PB_City] & " * " in order to get partial text from the table but it don't show a record if the field is blank.

The code Like " * " & [Forms]![AnyForm]![AnyThing] & " * " leave out the Blank records as I like to use the query designer I wonder what's the exact syntax for the SQL or how to work in the query designer to get this work done as well


Solution

  • I found a code whats work type in query designer the following:


    if you want to write in SQL take a look on this question,

    Click on this link https://stackoverflow.com/a/38899574/9661307

    or https://stackoverflow.com/a/38852152/9661307


    in Query designer do the following

    under your column you do the criteria

    Like "*" & [Forms]![myForm]![myControl] & "*" OR [Forms]![myForm]![myControl] Is 
    Null