MS Access关键字搜索多个字段 [英] MS Access keyword search by multiple fields

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

问题描述

嘿大家好基本上,我想在过滤后的集合中搜索关键字而不重置我的第一个过滤器。


我目前有一个拆分表单,其中包含一个包含所有字段下拉列表的组合框。旁边是一个文本框,用于根据所选字段搜索关键字。旁边是我的搜索按钮。


下面的代码允许我搜索任何单个字段的关键字。如果我进行第二次搜索,它将搜索重置过滤器的原始数据集。我想在过滤结果中搜索。例如,我第一次搜索客户名称史密斯时有5000条记录。带我去10条记录。从那些10,我想从我现有的下拉列表和关键字搜索中选择另一个字段进一步向下钻取。


这是我的代码(Text35是文本框, searchlist是字段名称的组合框列表:

展开 | 选择 | Wrap | 行号

解决方案

可能有一个更简单的方法(如果任何其他专家想要加权,我很乐意听到它),但我通常做的是检查当前是否有过滤器然后如果有,添加到现有科幻滤波器。所以像这样:

展开 | 选择 | Wrap | 行号


Seth,


我喜欢你的想法。我打算沿着同样的路线提出建议。


从本质上讲,我们是过滤过滤器。


只是不要''试试gefilte fish。


哇它完美无缺。非常感谢!我一直在敲我的头重写这段代码几天没有通过谷歌或堆栈溢出找到任何帮助。你知道我想要什么,并在几分钟内解决我的问题。


所以通过使用创建另一个变量strFilter实际上创建了第二个过滤器,我们可以与Me.Filter进行比较?


我不想花太多时间,但如果你不介意的话我还有另外一个小问题。当我选择字段日期时在我的下拉列表中,是否可以按整个月搜索,例如3月而不是像3/15/18这样的特定日期?


Hey everyone. Essentially, I''d like to search keywords within a filtered set without resetting my first filter.

I currently have a split form with a combo box containing a dropdown of all fields. Next to it is a text box to search keywords based off the field selected. Next to that is my search button.

The code below allows me to search keywords off any single field. If I do a 2nd search, it searches off the original data set resetting the filter. I would like to search within filtered results. For example, i have 5000 records my first search of customer name "Smith" takes me to 10 records. From those 10, I''d like to select another field from my existing drop down list and keyword search to drill down further.

Here is my code (Text35 is the text box and searchlist is the combobox list of field names):

Expand|Select|Wrap|Line Numbers

解决方案

There may be an easier way (if any of the other experts want to weight in, I would love to hear it), but what I normally do is check to see if there is a filter currently in place and then if there is, add to the existing filter. So something like this:

Expand|Select|Wrap|Line Numbers


Seth,

I like how you think. I was going to suggest along the same lines.

In essence, we are "filtering a filter".

Just don''t try the gefilte fish.


Wow it worked perfectly. Thank you so much! I have been banging my head rewriting this code for a couple days without finding any help through google or on stack overflow. You come along knowing exactly what I want and solve my issue within a couple minutes.

So by using creating another variable strFilter was essentially creating a 2nd filter for us to compare with Me.Filter?

I don''t want to take too much of your time, but I had one other minor question if you didn''t mind. When I choose the field "Date" in my drop down list, is it possible to search by an entire month such as March instead of a specific date like 3/15/18?


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

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