在Query where子句中添加通配符? (访问'16)

问题描述 投票:0回答:1

My Query根据搜索表单中的几个不同的未绑定字段提取记录。对于可搜索的字段,我在每个查询字段的第二个条件中使用以下内容:

Like Nz([field_in_search_form], "*")

对于Name字段,我希望最终用户输入“Tony”并获得诸如“Tony”,“Tony B.”,“Tony Bacon”,“Tony Bacon和Alfred Ham”等结果。

有没有办法在标准中使用通配符?另一个IT人员建议我将字段设置为局部变量,然后将通配符添加到变量中,但我无法以有用的方式在Web上搜索。

谢谢!

where criteria ms-access-2016
1个回答
0
投票

试试(SQL):

Select * From YourTable
Where [YourField] Like [field_in_search_form] & "*"

如果应包括Null:

Select * From YourTable
Where ([YourField] Like [field_in_search_form] & "*") Or ([field_in_search_form] Is Null)
© www.soinside.com 2019 - 2024. All rights reserved.