使用表单中的参数作为 "like" sql 语句的一部分

Using parameter from a form as part of a "like" sql statement

我有这样的查询:

select name,label from tablename where label like '*[form]![label search]![searchtxt]*';

我知道查询在某种意义上有效,如果我将“[form]![label search}![searchtxt]”替换为实际单词,则查询有效。当我按原样 运行 查询时,表单中的数据不会进入查询,因此我没有得到任何行。

如何让查询的类似部分与来自表单的输入一起使用。我意识到除了 SQL.

之外,这可能还需要一些 VBA

谢谢

您需要连接其中的星号。例如:

select name,label from tablename where label like '*' & [form]![label search]![searchtxt] & '*';