做一个“或”使用文本框中的条件进行搜索 [英] Doing an "Or" search using criteria from a text box

查看:58
本文介绍了做一个“或”使用文本框中的条件进行搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



还有一件事,我需要帮助,我很害怕。我先解释一下我想要什么,然后我会试着解释一下我的想法。我正在使用Microsoft Access 2000.


我想要的是能够进行搜索,从表格上的文本框中取出标准。这一点很简单,完成了数十万次。但我希望它是一个或搜索。如果我输入Cakes,Cheese,我不希望它提出含有蛋糕和奶酪的结果,我希望它能提出包含蛋糕或奶酪的所有结果。现在,如果我把我想要的东西放进查询中,我就可以做到这一点。所以,如果我输入查询:

Hi,
Yet another thing I need help with I''m affraid. I''ll first explain what I want, then I''ll try to explain what I have. I''m using Microsoft Access 2000.

What I want is to be able to do a search, taking it''s criteria fro a text box on a form. This bit is easy, done it a jazillion times. But I want it to be an "Or" search. If I type in it "Cakes, Cheese", I don''t want it to bring up results that contain cakes AND cheese, I want it to bring up all results that contain either cakes OR cheese. Now, I can do this if I put what I want into the query. So if I put in the query:

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

推荐答案




还有一件事,我需要帮助,我很害怕。我先解释一下我想要什么,然后我会试着解释一下我的想法。我正在使用Microsoft Access 2000.


我想要的是能够进行搜索,从表格上的文本框中取出标准。这一点很简单,完成了数十万次。但我希望它是一个或搜索。如果我输入Cakes,Cheese,我不希望它提出含有蛋糕和奶酪的结果,我希望它能提出包含蛋糕或奶酪的所有结果。现在,如果我把我想要的东西放进查询中,我就可以做到这一点。所以,如果我输入查询:
Hi,
Yet another thing I need help with I''m affraid. I''ll first explain what I want, then I''ll try to explain what I have. I''m using Microsoft Access 2000.

What I want is to be able to do a search, taking it''s criteria fro a text box on a form. This bit is easy, done it a jazillion times. But I want it to be an "Or" search. If I type in it "Cakes, Cheese", I don''t want it to bring up results that contain cakes AND cheese, I want it to bring up all results that contain either cakes OR cheese. Now, I can do this if I put what I want into the query. So if I put in the query:
展开 | 选择 < span class =codeDivider> | Wrap | 行号


感谢您的快速回复。我试图实现你的代码,但我遇到了一些麻烦。在代码的最后,它说Me.Recordsource = strsql_1,我需要它在另一个表单上实现sql,而不是当前的。很容易做到,我只是用表格名称替换了''我'。我认为这会奏效。但是现在在那行上我得到运行时错误'424''对象必需'。


我有两种形式:一种用于搜索(包含文本)框来搜索)和另一个表格来显示结果。我将代码放在包含文本框的搜索表单上的按钮中。文本框称为主题。显示结果的表单称为SearchResults。表格中所有数据都称为资源,我们希望从此表中获得结果的字段是主题。


这就是我的意思你的代码做了(我把它放在点击程序中,包含文本框的搜索表单上的按钮):
Thank you for your very quick response. I''ve tried to implement your code, but I am having a little trouble. At the end of your code, where it says Me.Recordsource = strsql_1, I need it to implement the sql on another form, not the current. Easy enough to do, I just replaced ''Me'' with the form name. I thought that would work. But now on that line I get "Run-time error ''424'' Object Required".

I have two forms: one for doing the searching from (that contains the text box to search from) and another form to show the results. I put the code into a button on the search form that contains the text box. The text box is called "Subject". The form that shows the results is called "SearchResults". The table taht cotains all the data is called "Resources", and the field we want to get results from in this table is "Subject".

Here''s what I did with your code (I put it in a on click procedure for a button on the search form that contains the text box):
展开 | 选择 | 换行 | 行号



感谢您的快速回复。我试图实现你的代码,但我遇到了一些麻烦。在代码的最后,它说Me.Recordsource = strsql_1,我需要它在另一个表单上实现sql,而不是当前的。很容易做到,我只是用表格名称替换了''我'。我认为这会奏效。但是现在在那行上我得到运行时错误'424''对象必需'。


我有两种形式:一种用于搜索(包含文本)框来搜索)和另一个表格来显示结果。我将代码放在包含文本框的搜索表单上的按钮中。文本框称为主题。显示结果的表单称为SearchResults。表格中所有数据都称为资源,我们希望从此表中获得结果的字段是主题。


这就是我的意思你的代码做了(我把它放在点击程序中,包含文本框的搜索表单上的按钮):
Thank you for your very quick response. I''ve tried to implement your code, but I am having a little trouble. At the end of your code, where it says Me.Recordsource = strsql_1, I need it to implement the sql on another form, not the current. Easy enough to do, I just replaced ''Me'' with the form name. I thought that would work. But now on that line I get "Run-time error ''424'' Object Required".

I have two forms: one for doing the searching from (that contains the text box to search from) and another form to show the results. I put the code into a button on the search form that contains the text box. The text box is called "Subject". The form that shows the results is called "SearchResults". The table taht cotains all the data is called "Resources", and the field we want to get results from in this table is "Subject".

Here''s what I did with your code (I put it in a on click procedure for a button on the search form that contains the text box):
展开 | 选择 | 换行 | 行号


这篇关于做一个“或”使用文本框中的条件进行搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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