我有这个A2K数据库有一个连续的表格,列出供应商 及其详细信息。该表单有一个字段,供每个供应商持有 几个反映供应商产品或服务的关键字。 我是新手编写VB但是设法创建一个命令按钮, 根据我在文本框中输入的关键字过滤表单。我拥有的 代码是: - Dim strFilter As String strFilter ="([Keywords] like'' *"& [txtSearch]&" *'')" Forms![FrmSuppliersAll] .Filter = strFilter Forms![FrmSuppliersAll] .FilterOn = True 这会过滤供应商表单确定,但它也会给出结果,其中 关键字可能是较大单词的一部分,例如说我要过滤 运动,它将返回运动,运输,运动等。 问题是,有没有办法修改代码,以便只仅返回带有关键字本身的记录,即体育?
I''ve got this A2K DB that has a continuous form that lists Suppliers and their details. The form has a field for each supplier that holds several Keywords that reflect the suppliers products or services. I am new to writing VB but managed to create a command button that filters the form based on a keyword that I type into a text box . The code I have is :- Dim strFilter As String strFilter = "([Keywords] Like ''*" & [txtSearch] & "*'')" Forms![FrmSuppliersAll].Filter = strFilter Forms![FrmSuppliersAll].FilterOn = True This filters the suppliers form OK but it also gives results where the keyword may be part of a larger word eg say I want to filter on "Sport", it will return sports, transport, sporting, etc. Question is, is there any way to modify the code so that only only records withthe Keyword itself is returned ie "Sport"?
推荐答案" Chantelle" < SA ******* @ yahoo>在消息中写道 news:11 ********************* @ g14g2000cwa.googlegro ups ... "Chantelle" <sa*******@yahoo> wrote in message news:11*********************@g14g2000cwa.googlegro ups... 我有这个A2K DB,它有一个连续的表格,列出供应商及其详细信息。该表单为每个供应商提供了一个字段,其中包含几个反映供应商产品或服务的关键字。 我是新手编写VB但是设法创建了一个命令按钮根据我在文本框中键入的关键字过滤表单。我的代码是: - Dim strFilter As String strFilter ="([Keywords] like''*"& [txtSearch]&" *'')" 表格![FrmSuppliersAll] .Filter = strFilter 表格![FrmSuppliersAll] .FilterOn = True 这会过滤供应商表单确定但它也给出了结果,关键字可能是更大词的一部分,例如说我想过滤运动,它将返回运动,运输,运动等。 问题是,有没有办法修改代码,以便只返回带有关键字本身的记录,即运动? I''ve got this A2K DB that has a continuous form that lists Suppliers and their details. The form has a field for each supplier that holds several Keywords that reflect the suppliers products or services. I am new to writing VB but managed to create a command button that filters the form based on a keyword that I type into a text box . The code I have is :- Dim strFilter As String strFilter = "([Keywords] Like ''*" & [txtSearch] & "*'')" Forms![FrmSuppliersAll].Filter = strFilter Forms![FrmSuppliersAll].FilterOn = True This filters the suppliers form OK but it also gives results where the keyword may be part of a larger word eg say I want to filter on "Sport", it will return sports, transport, sporting, etc. Question is, is there any way to modify the code so that only only records withthe Keyword itself is returned ie "Sport"?
* character是一个通配符。删除那些和相邻的&符号。 strFilter =" [Keywords] = [txtSearch]" Keith。 www.keithwilby
" Chantelle" < SA ******* @ yahoo>在消息中写道 news:11 ********************* @ g14g2000cwa.googlegro ups ... "Chantelle" <sa*******@yahoo> wrote in message news:11*********************@g14g2000cwa.googlegro ups... 我有这个A2K DB,它有一个连续的表格,列出供应商及其详细信息。该表单为每个供应商提供了一个字段,其中包含几个反映供应商产品或服务的关键字。 我是新手编写VB但是设法创建了一个命令按钮根据我在文本框中键入的关键字过滤表单。我的代码是: - Dim strFilter As String strFilter ="([Keywords] like''*"& [txtSearch]&" *'')" 表格![FrmSuppliersAll] .Filter = strFilter 表格![FrmSuppliersAll] .FilterOn = True 这会过滤供应商表单确定但它也给出了结果,关键字可能是更大词的一部分,例如说我想过滤运动,它将返回运动,运输,运动等。 问题是,有没有办法修改代码,以便只返回带有关键字本身的记录,即运动? I''ve got this A2K DB that has a continuous form that lists Suppliers and their details. The form has a field for each supplier that holds several Keywords that reflect the suppliers products or services. I am new to writing VB but managed to create a command button that filters the form based on a keyword that I type into a text box . The code I have is :- Dim strFilter As String strFilter = "([Keywords] Like ''*" & [txtSearch] & "*'')" Forms![FrmSuppliersAll].Filter = strFilter Forms![FrmSuppliersAll].FilterOn = True This filters the suppliers form OK but it also gives results where the keyword may be part of a larger word eg say I want to filter on "Sport", it will return sports, transport, sporting, etc. Question is, is there any way to modify the code so that only only records withthe Keyword itself is returned ie "Sport"?
你可以找到 运动并且这些空格将确保您只得到关键字出现的,但在典型的句子中,您可能找不到 这个词周围的空格,例如:标点符号或在字段的开头: 我喜欢运动,但我很懒。 运动不适合我。 我不做运动! 等 如果文本是非结构化的话,那就不那么容易了。当然, 如果文件中的文字格式可靠,那么关键字是 保证如下: | sport |交通|农业|学校|监狱| 然后你可以搜索|运动|这将保证匹配。 最好还是重新构建数据库,以便有一个 相关的关键字表,并放置一个索引在这个领域。你会发现搜索变得非常快,你可以用其他格式执行 查询。
" Keith Wilby" <他** @ there>在消息中写道 news:43 ********** @glkas0286.greenlnk ... "Keith Wilby" <he**@there> wrote in message news:43**********@glkas0286.greenlnk... " Chantelle" < SA ******* @ yahoo>在消息中写道新闻:11 ********************* @ g14g2000cwa.googlegro ups ... "Chantelle" <sa*******@yahoo> wrote in message news:11*********************@g14g2000cwa.googlegro ups... I '这个A2K数据库有一个连续的表格,列出供应商及其详细信息。该表单为每个供应商提供了一个字段,其中包含几个反映供应商产品或服务的关键字。 我是新手编写VB但是设法创建了一个命令按钮根据我在文本框中键入的关键字过滤表单。我的代码是: - Dim strFilter As String strFilter ="([Keywords] like''*"& [txtSearch]&" *'')" 表格![FrmSuppliersAll] .Filter = strFilter 表格![FrmSuppliersAll] .FilterOn = True 这会过滤供应商表单确定但它也给出了结果,关键字可能是更大词的一部分,例如说我想过滤运动,它将返回运动,运输,运动等。 问题是,有没有办法修改代码,以便只返回带有关键字本身的记录,即运动? I''ve got this A2K DB that has a continuous form that lists Suppliers and their details. The form has a field for each supplier that holds several Keywords that reflect the suppliers products or services. I am new to writing VB but managed to create a command button that filters the form based on a keyword that I type into a text box . The code I have is :- Dim strFilter As String strFilter = "([Keywords] Like ''*" & [txtSearch] & "*'')" Forms![FrmSuppliersAll].Filter = strFilter Forms![FrmSuppliersAll].FilterOn = True This filters the suppliers form OK but it also gives results where the keyword may be part of a larger word eg say I want to filter on "Sport", it will return sports, transport, sporting, etc. Question is, is there any way to modify the code so that only only records withthe Keyword itself is returned ie "Sport"?
* character是一个通配符。删除那些和相邻的&符号。 strFilter =" [keywords] = [txtSearch]" 基思。 www.keithwilby
基思 - 最后你答应过的时候你会停止尝试阅读 快进模式;)
Keith - Last time you promised you were going to stop trying to read in fast-forward mode ;)
更多推荐
返回整个单词进行过滤
发布评论