根据多个组合框过滤查询,但如果组合框为空,则显示所有记录,包括空、 [英] 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
我在查询设计器中使用过这段代码喜欢"* "&[表格]![顾客]![PB_City] &"* "
以便从表格中获取部分文本但如果该字段为空,则不会显示记录.
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.
代码喜欢"* "&[表格]![AnyForm]![AnyThing] &"* "
省略空白记录因为我喜欢使用查询设计器我想知道 SQL 的确切语法是什么,或者如何在查询设计器中工作也完成这项工作
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
推荐答案
我在查询设计器中找到了以下代码:
I found a code whats work type in query designer the following:
如果你想用 SQL 写,看看这个问题,
if you want to write in SQL take a look on this question,
点击这个链接https://stackoverflow.com/a/38899574/9661307
或https://stackoverflow.com/a/38852152/9661307
在查询设计器中执行以下操作
in Query designer do the following
在你的专栏下你做标准
Like "*" & [Forms]![myForm]![myControl] & "*" OR [Forms]![myForm]![myControl] Is
Null
这篇关于根据多个组合框过滤查询,但如果组合框为空,则显示所有记录,包括空、的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!