搜索框问题 [英] Search Box Problem

查看:73
本文介绍了搜索框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


首先,我的名字是Shan,我目前正在学习并在Access中设计数据库。你的论坛用户似乎非常乐于助人和专家,所以我想我可以问一两个问题。


我有一个包含大约15个字段的表,2个日期字段和休息文本。


我设计了一个使用LIKE的搜索表单。搜索功能。


但是,有些字段有多个关键字,用逗号分隔


例如:字段名称:作者


1. James B,Johnathan D

2. Matt W,Steve J


这是两个条目......现在如果我搜索James B,Johnathan D然后它给出结果[我没有使用查询来执行此操作,我实际上定义了作为条件输入的文本,然后使用它来搜索我的table.field然后将其返回到我输入数据的输入表单]


但是,如果我输入Jonathan D,James B,在搜索texbox然后它不会返回任何结果...因为我们知道LIKE函数逐字逐句比较我的标准是相反的


有没有办法修改(或新的方式使其成为可以比较逗号中的每个搜索字符串。我要说的是你输入Johnathan D,James B。作为我的搜索字符串


然后它应该采取Johnathan D并搜索作者字段(比如说找到1个场合)然后它将采用詹姆斯B。并搜索作者字段并(说它找到上述记录1的相同场合)并且由于两者都返回1次,它会显示该记录吗?还是有其他方式/更简单的方法吗?


谢谢你,如果我没有解释清楚,请告诉我。


再次感谢您的时间!


干杯,

解决方案

试试此功能:

展开 | 选择 | Wrap | 行号


如果按逻辑分解您的要求,您将不是要比较的单个字符串看到你真的想分别比较两个字符串,尽管是在同一个字段中。


如果以两种形式的TextBox控件输入它们(txtSearch1& txtSearch2)然后你可以制作表格的WHERE子句(或过滤器):

展开 | 选择 | Wrap | 行号



而不是单个字符串进行比较,如果你按逻辑分解你的要求,你会发现你真的想要分别比较两个字符串,尽管是在同一个字段中。


如果以两种形式的TextBox控件(txtSearch1& txtSearch2)输入它们,那么你可以制作表格的WHERE子句(或过滤器):

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Hello all,

First of all my name is Shan and I am currently learning and also designing a database in Access. Your forum users seems to be very helpful and experts in this matter so I thought I could ask around a question or two.

I have a table with around 15 fields, 2 date fields and rest text.

I designed a search form which uses the "LIKE" function to search.

Howevever, some of the fields have multiple keywords, sperated by commas

Eg: Field Name: Author

1. James B, Johnathan D
2. Matt W, Steve J

Those are 2 entries...now if I search for "James B, Johnathan D" then it gives the result [I am not using a query to do this, I am actually defining the text entered as the criteria and then using that to search my table.field then returning that to the input form where I input data]

However, if I type "Jonathan D, James B" in search texbox then it wont return any results...as we know the LIKE function compares word by word and my criteria is in reverse

Is there any way to modify (or new way) to make it so that the each search string within commas would be compared. What I am saying is say you enter "Johnathan D, James B" as my search string

Then it should take "Johnathan D" and search the Author field (say it finds 1 occasion) then it would take "James B" and search the Author field and (say it finds same occasion which is record 1 mentioned above ) and since both returned 1 occasion, it would display that record? or is there other ways/easier ways to do this?

Thank you and please let me know if I did not explain this well.

Thanks again for your time!

Cheers,
Shan

解决方案

Try this function:

Expand|Select|Wrap|Line Numbers


Rather than a single string to compare, if you break down your requirement logically, you will see that you really want to compare two strings separately, albeit within the same field.

If you enter them in two form TextBox controls (txtSearch1 & txtSearch2) then you can make your WHERE clause (or filter) of the form :

Expand|Select|Wrap|Line Numbers


Rather than a single string to compare, if you break down your requirement logically, you will see that you really want to compare two strings separately, albeit within the same field.

If you enter them in two form TextBox controls (txtSearch1 & txtSearch2) then you can make your WHERE clause (or filter) of the form :

Expand|Select|Wrap|Line Numbers


这篇关于搜索框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆