返回整个单词进行过滤

编程入门 行业动态 更新时间:2024-10-28 18:27:18
本文介绍了返回整个单词进行过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有这个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 ;)

更多推荐

返回整个单词进行过滤

本文发布于:2023-11-06 09:31:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1563317.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单词

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!